-
[Ruby] Even_numscoding for food 2022. 7. 24. 07:07
my code == solution
def even_nums(max) i = 0 evenall = [] while i <= max if i % 2 == 0 evenall << i end i += 1 end return evenall end print even_nums(10) # => [0, 2, 4, 6, 8, 10] puts print even_nums(5) # => [0, 2, 4]