Blocks
In Sidef, a block of code is an object which encapsulates zero or more expressions and is delimited by a pair of curly braces ({}
).
Block parameters
For declaring block parameters, Sidef borrows Ruby's way of doing this, by using the |arg1, arg2, ...|
special syntax:
Callbacks
Blocks are also used as arguments to many built-in methods as callback blocks:
The Block
class also implements some useful methods, such as:
Last updated