Each
Last updated
What is Each?
each is a fundamental method in Ruby used to iterate over elements within a collection, such as an array or a hash. It applies a given block of code to each element in the collection, allowing you to perform operations on every item. The each method does not modify the original collection; it simply iterates through it.
Free resources to learn Each
- Official docsIterators
- ArticleIterators
- ArticleRuby Explained: Iteration
More in stage 11: Loops & Enumerations
Each: common questions
Can I learn Each in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Each in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this Each tutorial for beginners?
It is lesson 35 of 102 in the free Ruby roadmap, in stage 11, Loops & Enumerations. If you are new to Ruby, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.