Introduction
Ruby prefers iterators because they make code easier to read and write. Iterators help you work with collections like lists in a simple and clear way.
When you want to go through each item in a list or array.
When you want to perform an action on every element without writing extra code for counting.
When you want your code to be clean and easy to understand.
When you want to avoid mistakes that come from managing loop counters.
When you want to use Ruby's built-in methods that work with collections.