how to use next on ruby for this case?
ruby
Solution
You can just insert a `next` that skips the rest of the loop if the number is odd:
i = 20
loop do
i -= 1
next if i.odd?
puts "#{i}"
break if i <= 0
end
Problem
I'm learning Ruby On Rails program and I've came to a road block on one of the lessons. The assignment has me creating an odd numbers for the script to read starting from "20 to 0" using the `next` component. This is the example they've given me to change : ``` i = 20 loop do i -= 1 print "#{i}" break if i <= 0 end ``` This is the problem: Add a line to your loop before your print statement. Use the `next` keyword so that you skip to the next iteration if the number i is odd. How do I accomplish this?