let

Synopsis

& let(&closure, $key => "value", ...)

Updates the specified closure's environment with all of the key/value pair arguments. Returns the specified closure.

Parameters

&closure - the closure to update the "this" scope for.

$key => value - sets $key in the this scope of the specified closure to the right hand side value.

Returns

The specified &closure

Side Effects / Notes

Examples

$foo = { println("My favorite is $icecream with $topping"); }; let($foo, $icecream => "mint chocolate chip", $topping => "sprinkles"); [$foo]; let($foo, $topping => "strawberries"); # update $foo with a new $topping [$foo];

My favorite is mint chocolate chip with sprinkles My favorite is mint chocolate chip with strawberries

See Also