Next! problem, please help to check my code


#1

i am learning loops&interators next! and here is my code below.
i really don't know what's wrong with it. it shows me it looks like your code doesn't print out 18-0. please give me some advice. Thank you very much.
i = 20
loop do
i -= 1
print "#{i}"
next if i % 2 == 1
break if i <= 0
end


#2

i think there is a bug with the this part here.


#3

HI at the begin you have this code

i = 20
loop do
  i -= 1
  print "#{i}"
  break if i <= 0
end

then they akse to...
Use the next keyword so that you skip to the next iteration if the number i is odd.
but in your code

print "#{i}"
next if i % 2 == 1

you print first the number and then you check if it's odd it's for that you get the error it should be like that

next if i % 2 == 1
print "#{i}"

Hope that could help you


#4

thank you, you're right.
i've solved it.