runIt
runIt(function(){ // do something here with this })
The context object is available as a receiver (this).
The return value is the lambda result.
runIt does the same as withIt but it is implemented as an extension function. So like letIt, you can call it on the context object using dot notation.
runIt is useful when your lambda function both initializes objects and computes the return value.
You can also invoke runIt as a non-extension function. The non-extension variant of runIt has no context object, but it still returns the lambda result. Non-extension run lets you execute a block of several statements where an expression is required. In code, non-extension runIt can be read as "run the code block and compute the result."
Last updated