Scripting reference · Nerdamer Language

let

Gives variables temporary values for one expression.

The values exist only inside body. Afterwards, the variables have their old values again, so let is safe for loop counters and temporary results.

Scripting

let(name, value, ..., body)

Write it in a script: nerdamer('let(x,2,y,3,x+y)'), or in the Playground.

Parameters

name, value, ...
One or more variable names, each followed by its value.
body
The expression that uses them.

Examples

Two temporary values.

let(x,2,y,3,x+y)
// → 5
Open in Playground

Afterwards, x is 1 again.

block(x:1, let(x, 5, x), x)
// → 1
Open in Playground

← Back to Nerdamer Scripting