Next if problem

#1

i have a problem in this.Its not running.can you please tell me how i can solve it?

Next if?
#2

The instructions ask us to skip the odd values of `i`.

``next if i % 2 != 0``

#3

I put
i = 20
loop do
i -= 1
next if i% 2!=0
print "#{i} "
break if i <= 0
end
it prints 18 16 14 12 10 8 6 4 2 0 nil
but says "Oops, try again. It looks like your loop doesn't print out the numbers 18 to 0."

#4

I put a space after print "#{i} to make it look nicer.
The tutorial is looking for 181614 etc in the answer.

#5

For all intent and purpose I believe that your code should qualify as a correct answer ( having done the same myself to no avail. When i put the same code the console gave and output of all even number including 0 and -2. On an assumption I adjusted the code to not output -2 and it resolved without and issue on that try.

To do so this is what i wrote:
break if i < 0 || i == 0

Good Luck & Stay Trill

lol

#6

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