Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor
Learn
Methods, Blocks, & Sorting

How Blocks Differ from Methods

There are some differences between blocks and methods, however.

Check out the code in the editor. The capitalize method capitalizes a word, and we can continually invoke the capitalize method by name. We can capitalize("matz"), capitalize("eduardo"), or any string we like to our hearts' content.

However, the block that we define (following .each) will only be called once, and in the context of the array that we are iterating over. It appears just long enough to do some work for each, then vanishes into the night.

Instructions

Make sense? Run the code to see the magical marriage of methods and blocks.

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