I have a program :
Question : Input a number of integer of 2 digit only , and in the out-put it should show the all input values BUT loop should stop on 42 :
example
input
1 2 87 42 99
output
1 2 87
my code
a = []
5.times do |i|
a[i] = Integer(gets.chomp)
end
a.each do |e|
break if e == '42'
puts e
end