Hi,

I’m a little stuck on exercise 9. I know the answer but I don’t understand the code.

So it says we need to create a loop with even values up to 20, I know we need to exclude the odd values, but in order to specify what to exclude we say “next if i % 2 == 1”

However odd numbers % 2 does not equal 1, it equals a different number. So how did the reader figure that when we are talking about excluding numbers that essentially we need to add 1 to, in order to divide it by 2 to create a whole number.

code:

i = 20

loop do

i -= 1

next if i % 2 == 1

print “#{i}”

break if i <= 0

end

https://www.codecademy.com/courses/ruby-beginner-en-XYcN1/2/2?curriculum_id=5059f8619189a5000201fbcb