0Pricing
Ruby Academy · Lesson

Iterating Over Collections

Use each, map, select, and other iteration methods to process collections effectively.

1

Iterating Over Collections

Iteration allows you to process each element in an array or hash.

In this lesson, you will learn how to use methods like each, map, and select.

Iterating Over Collections — illustration 1

2

Using Each with Arrays

The each method loops through each element in an array.

[1, 2, 3].each { |num| puts num * 2 }

All lessons in this course

  1. Arrays and Hashes
  2. Iterating Over Collections
  3. Useful Array and Hash Methods
← Back to Ruby Academy