Mention UFCS
This commit is contained in:
parent
e793276f2a
commit
c65319376e
1 changed files with 2 additions and 2 deletions
|
|
@ -3,14 +3,14 @@ title: Procs
|
|||
---
|
||||
# Procs
|
||||
|
||||
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.
|
||||
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. Another thing to note is that procedures have uniform function call syntax, which means that they can called as both `foo(a, b)` or `a.foo(b)`.
|
||||
|
||||
``` nimrod
|
||||
proc fibonacci(n: int): int =
|
||||
if n < 2:
|
||||
result = n
|
||||
else:
|
||||
result = fibonacci(n - 1) + fibonacci(n - 2)
|
||||
result = fibonacci(n - 1) + (n - 2).fibonacci
|
||||
```
|
||||
|
||||
## Exporting symbols
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue