2 ms·
My understanding is that the 'extra thing' is control flow - blocks can force a return in their calling scope. For example a loop that calls a block may be term
by somewhereoutth 1y ago
My understanding is that the 'extra thing' is control flow - blocks can force a return in their calling scope. For example a loop that calls a block may be terminated/skipped by a break/continue statement in the block itself. However I'm not a Ruby programmer, so please check my working.
- vidarh 1y agoBlocks can force a return in their defining scope. If you pass a block down through multiple methods and then call it, the return will exit the lexical scope the block was defined in, not the method it was ultimately called from. It usually looks pretty much the same, and so for most intents what you described is "close enough" to get most used of blocks.