revert to nested lists
This commit is contained in:
parent
4e0d445f3a
commit
fb97a53b49
2 changed files with 8 additions and 8 deletions
|
|
@ -6,9 +6,9 @@ title: Procedures
|
|||
Procedures in Nimrod are declared using `proc` and require that their parameter and return types be annotated. After the types and parameters, an `=` is used to denote the start of the function body.
|
||||
|
||||
``` nimrod
|
||||
proc fibonacci(a, b, n: int): int =
|
||||
if n > 1:
|
||||
result = fibonacci(b, a+b, n - 1)
|
||||
else
|
||||
a
|
||||
proc fibonacci(n: int): int =
|
||||
if n < 2:
|
||||
result = n
|
||||
else:
|
||||
result = fibonacci(n - 1) + fibonacci(n - 2)
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue