Skip to content

Commit

Permalink
Update recursive-types.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jessiemongeon1 authored Sep 27, 2024
1 parent d69aa3b commit 82c880f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions doc/md/writing-motoko/recursive-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ A recursive function can be used to retrieve the last element of a given list:

```motoko no-repl
func last<T>(l : List<T>) : ?T {
switch l {
case null { null };
case (?(x, null)) { ?x };
case (?(_, t)) { last<T>(t) };
};
switch l {
case null { null };
case (?(x, null)) { ?x };
case (?(_, t)) { last<T>(t) };
};
};
```

Expand Down

0 comments on commit 82c880f

Please sign in to comment.