Mention UFCS

This commit is contained in:
flaviut 2014-07-16 20:25:31 -04:00
commit c65319376e

View file

@ -3,14 +3,14 @@ title: Procs
--- ---
# 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 ``` nimrod
proc fibonacci(n: int): int = proc fibonacci(n: int): int =
if n < 2: if n < 2:
result = n result = n
else: else:
result = fibonacci(n - 1) + fibonacci(n - 2) result = fibonacci(n - 1) + (n - 2).fibonacci
``` ```
## Exporting symbols ## Exporting symbols