Anonymous function (function)
A function with no name; also written x => body.
How to write it
function(parameters, body)
- parameters
- The parameter, or a list of parameters in brackets. Takes a variable, or a list of variables.
- body
- The expression to evaluate. Takes an expression.
Examples
(x => x^2)(3)In the solver,
Open in the solver(x => x^2)(3)gives9.
Related functions
- ifelse
A value chosen by a test.
- evaluate
Evaluate an expression even where it would be held.
- increment
Add 1 to a variable in place and return its old value.
- divide_by
Divide a variable by a value in place and return the new value.
- indicator
A condition as a number: 1 when it is true and 0 when it is false.
- decrement
Subtract 1 from a variable in place and return its old value.