January 2024
Intermediate to advanced
718 pages
20h 15m
English
A code block is a set of Ruby statements and expressions inside braces or a do/end pair. The block may start with an argument list between vertical bars. A code block may appear only immediately after a method invocation. The start of the block (the brace or the do) must be on the same logical source line as the end of the invocation:
Braces have a high precedence; do has a low precedence. If the method invocation has parameters that aren’t enclosed in parentheses, the brace form of a block will bind to the last parameter, not to the overall invocation. The do form will bind to the entire invocation.
Within the body of the invoked method, the ...
Read now
Unlock full access