Next in Loop section lesson 11


Can not figure out how to showcase odd value.

This is what I got and it's not working.

i = 20
loop do
i -= 1
next if (i -- 1) / 2 == 0
print "#{i}"
break if i <= 0

this is my error : It looks like your loop doesn't print out the numbers 18 to 0.

and this is my result in the console :

obviously my odd numbers still printing.


You want to pass to the next iteration IF the number is NOT even. next if !(i % 2 == 0)


that is awesome! than you. so simple yet hard to think of the simplest solution.


It will get easier as you work in programming. :slight_smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.