Range and loop controls
- next
- break
- continue
(1..10).each { |ix|
next if ix % 2 == 0
break if ix == 7
puts ix
}
1
3
5
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
(1..10).each { |ix|
next if ix % 2 == 0
break if ix == 7
puts ix
}
1
3
5