Function definition: Difference between revisions

added langur language example
(add ArnoldC)
(added langur language example)
Line 1,491:
return a * b
}</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}}==
1,007

edits