Lesson 9


#1

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. what do they mean by this


#2

The 'next' keywork skips an input if a certain condition is met.
In my code below I wrote "next if i%2 == 1" The i%2 == 1 is testing to see if the number is odd or not. If it is then it will skip the input thus making only positive numbers show up in the console.

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