Learn

Iterating over arrays is easier than it looks.

numbers = [1, 2, 3, 4, 5] numbers.each { |element| puts element }
  1. In the example above, we create an array called numbers with 5 elements.
  2. Then we say, “Take this array and for each element, print it to the console.” As usual, we can use any placeholder name for the bit between two | | characters.

Instructions

1.

Use the .each iterator to puts out each element of the languages array.

Make sure to use puts instead of print, so each element is on its own line.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?