Loops
Repeating with times, range (1..n).each, arr.each, and while.
Simple enough for a 5-year-old to understand
times and range
In Ruby, times and each are preferred over for — they are more readable.
3.times { |i| puts i }(1..3).each { |n| puts n * 10 }🎯 Exercise & Practice
Test what you've learned — answer, write code, check instantly. (1 left)
🎯 Expected output: 1
2
3
4
5