Function definition: Difference between revisions
Content deleted Content added
add ArnoldC |
Langurmonkey (talk | contribs) added langur language example |
||
Line 1,491: | Line 1,491: | ||
return a * b |
return a * b |
||
}</lang> |
}</lang> |
||
=={{header|langur}}== |
|||
Functions defined with explicit parameters may be closures, and those defined with implied parameters are not. |
|||
A function body may use curly braces, but it is not required if it is a single expression. |
|||
=== explicit parameters === |
|||
Explicit parameters are defined with parentheses after the f token, with no spacing. To specify no parameters, use an empty set of parentheses. |
|||
<lang langur>val .multiply = f(.x, .y) .x x .y |
|||
.multiply(3, 4)</lang> |
|||
=== implied parameters === |
|||
Parameters are implied when the f token is not immediately followed by parentheses without spacing. |
|||
<lang langur>val .multiply = f .x x .y |
|||
.multiply(3, 4)</lang> |
|||
=={{header|Lasso}}== |
=={{header|Lasso}}== |