progress on procs
This commit is contained in:
parent
f88a7e98a0
commit
ab884689d2
1 changed files with 11 additions and 1 deletions
|
|
@ -2,3 +2,13 @@
|
||||||
title: Procedures
|
title: Procedures
|
||||||
---
|
---
|
||||||
# Procedures
|
# 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
|
||||||
|
```
|
||||||
Loading…
Add table
Add a link
Reference in a new issue