Call a function: Difference between revisions

Content added Content deleted
Line 3,700: Line 3,700:
<syntaxhighlight lang="langur">
<syntaxhighlight lang="langur">
val fibonacci = fn x:if x < 2 { x } else { fn((x - 1)) + fn((x - 2)) }
val fibonacci = fn x:if x < 2 { x } else { fn((x - 1)) + fn((x - 2)) }
</syntaxhighlight>

=== argument expansion ===
Use the expansion operator (...) to pass a list as multiple arguments. The following example works if wordsets is a list of lists, and passes each each list as a separate argument to the mapX function.

<syntaxhighlight lang="langur">
mapX(amb, wordsets...)
</syntaxhighlight>
</syntaxhighlight>