Ruby `for` loops are used to loop or iterate over a number of elements and execute a block of code for each element. For loops are often used on arrays. See section on <ahref='https://github.com/freeCodeCamp/guides/blob/master/src/pages/ruby/ruby-arrays/index.md'target='_blank'rel='nofollow'>Ruby Arrays</a>.
This would achieve exactly the same results as the aforementioned for loop, it is however neater and more efficient as it makes use of Array's built in methods.
To go one step further, we can write the above loop in the following way: