Scripting reference · Nerdamer Language

return

Ends a function or block early with a value.

In a function you defined, return ends the function. Outside one, it ends the outermost block.

Scripting

return(value)

Write it in a script: nerdamer('block(return(7),9)'), or in the Playground.

Parameters

value
The value to return.

Examples

9 is never reached.

block(return(7),9)
// → 7
Open in Playground

Return early for a negative input.

g(x):=block(if(x<0, return(0), 0), sqrt(x)); g(-4)
// → 0
Open in Playground

← Back to Nerdamer Scripting