Warning
You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
fun [2019/12/09 21:25] – [Functions with no parameters] neils | fun [2019/12/09 22:19] – [Calling functions] neils | ||
---|---|---|---|
Line 47: | Line 47: | ||
If you want a routine that does not return a value, use [[procedures|]] instead. | If you want a routine that does not return a value, use [[procedures|]] instead. | ||
- | ==== Functions with no parameters | + | ==== Parameterless functions |
You can omit the parameter list, but bear in mind that you still have to write the empty parentheses: | You can omit the parameter list, but bear in mind that you still have to write the empty parentheses: | ||
Line 58: | Line 58: | ||
You can call a function from within an expression by using the function name, sigil and the argument list in parentheses, | You can call a function from within an expression by using the function name, sigil and the argument list in parentheses, | ||
- | let x! = my_function!(a, | + | let x! = my_function!(a, |
| | ||
Note that in the example above '' | Note that in the example above '' | ||
Important note: you must pass exactly the same amount of parameters and the parameter types must match those in the function definition. | Important note: you must pass exactly the same amount of parameters and the parameter types must match those in the function definition. | ||
+ | |||
+ | ===== Recursion ===== | ||
+ | |||
+ | Unlike in procedures, recursion is not supported in functions yet. | ||