Ruby Block Scope

Ruby makes good use of anonymous functions (code blocks) which the calling functions yield arguments to: Under the hood, the upto method is looping from 1 to 3, and on each loop it yields the index to the associated code block (anonymous function). The value yielded to the block is received in the n argument, […]