Code Editor
Learn
Blocks, Procs, and Lambdas

Try It Yourself!

See? Even though this block business has a little more going on under the hood than we thought, it's still pretty straightforward.

Now that we know how methods accept blocks using the yield keyword, let's define our own method and pass it a block!

Report a Bug
If you see a bug or any other issue with this page, please report it here.