Skip to main content

Default Expressions

To provide a default value for a parameter, add an equals sign (=) followed by an expression after the parameter name. If the parameter's value is equal to undefined, its value will instead be calculated from its default expression. A parameter with a default expression is optional.

fn Function1(x=1, y=2) {
}

fn Example() {
// Set x to 123, but leave y to its default expression, which is 2
Example(123)

// This will have the same effect as the above
Example(123, undefined)
}