# In 9/13 even though I am sure I have fallowed the instructions correctly codcadomy

for i in 0…18
next if i / 2 == 0
print i
end

is this correct codecadomy?!?!?!?!?!?!??!??!??!??!?!?!?!?!??!?!??!?!?!? huh

Could you provide the lesson number or instructions in the lesson?

I’ve tried

`````` for i in 0...20
next if i % 2 == 1
print i
end
``````

and

``````for i in 0..18
next if i % 2 == 1
print i
end
``````

and

``````i = 20
while i != -1
i -= 1

next if i % 2 == 1

puts "#{i}"
end
``````

I’m getting the same error over and over: Oops, try again. It looks like your loop doesn’t print out the numbers 18 to 0.

The exercise is in “Looping with Ruby”, section 5. Loops & Iterators, number 9. Next.

Need a help here too.

Sorry, problem solved. I’ve write puts and the exercise required print. Not so flexible. =/

1 Like

This is what I did,

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

If 1 % 2 == 0 skipped the even numbers then 1 % 2 != 0 skips the odds.

3 Likes

I tried that and got a message saying false (!) statements are not allowed in this. 1% 2 = 0 means that when i is divided by 2 it has no remainder (i.e. is an even number), the answer has to be that the if i is divided by 2 there is a remainder, which means the change to the string is not before, but after the =. the code that works is next if i % 2 == 1

i dont mean to but can you at least learn how to spell correctly? “fallowed” is followed, “codcadomy” is codecademy!

Hardly anyone does that. I know it is annoying.

1 Like

Thanks …!! this one helped me

To me the question became unclear when I first tried the problem. After a few unsuccessful attempts and seeing the error alert, I found the below block of codes helpful:
i = 20
loop do
i -= 1
next if i % 2 != 0
print “#{i}”
break if i <= 0
end

I am stuck here, any hints

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