vault backup: 2023-09-12 16:20:45
This commit is contained in:
parent
42e289c63f
commit
e500ac3dac
@ -39,7 +39,18 @@ To write a recurvise function we need two things
|
||||
### 5.2. Down
|
||||
```Ocaml
|
||||
# let rec countdown n =
|
||||
if n = 0 then
|
||||
print_int(0)
|
||||
if n < 0 then
|
||||
()
|
||||
else
|
||||
print_int(countdown (n-1));;
|
||||
begin
|
||||
print_int n ;
|
||||
print_newline();
|
||||
countdown(n-1);
|
||||
end;;
|
||||
val countdown = int -> unit = ()
|
||||
|
||||
# countdown 3;;
|
||||
3
|
||||
2
|
||||
1
|
||||
- : unit = ()
|
Loading…
x
Reference in New Issue
Block a user