-
[Ruby] enumerable methods 3coding for food 2022. 7. 27. 11:21
(0...4).each { |num| puts num } ------------------------------- 0 1 2 3
#to repeat some code a certain number of time (0...4).each { puts "hello" } ------------------------------ hello hello hello hello # 아래와 같이 더 간단히 표현할 수 있다. 4.times { puts "hello" } ------------------------------ hello hello hello hello