They want me to loop 18 to 0 but i can only do it the other way around, need help


for i in 0..18
i += 1
next if i % 2 == 0
print "#{i}"


I don't think there's any exercise asking for 18 to 0. There's an exercise asking 20 to 0 however, but it's asking to use, not

Also, the for loop can't use a decreasing range (you're not supposed to use for anyway, but just to let you know).

Try to modify your code with a, and tell me how it works out.


when i submit my answer it sends an error saying, "your loop dose not show 18 to 0"


Please give me the number of the exercise you're on.


Loops & Iterators
Iterators & Blocks
.9 Next


Okay, you're supposed to just modify the loop you used to pass the previous exercise, which is a, not a .


still says "It looks like your loop doesn't print out the numbers 18 to 0." But thanks for pointing that out.
i = 20
loop do
i -= 1
next if i % 2 == 0.5
print "#{i}"
break if i <= 0

next if i % 2 == 0.5

A modulo operation will always give an integer.


Like suggested above, your line next if i % 2 == 0.5 needs some work.

Keep in mind you can tell it to skip if it doesn't equal a value for example %2 != 0

Hope that helps:)


Thank you arjofococolovi and mark_hollingsworth i tried it again after school and figured out the way that mark just mentioned when i looked on the forms after, just needed to clear my head a bit i guess Thank you again :relieved: