<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>
<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/ruby-beginner-en-XYcN1/2/2?curriculum_id=5059f8619189a5000201fbcb
<In what way does your code behave incorrectly? Include ALL error messages.>
(ruby):7: syntax error, unexpected $end, expecting keyword_end
```ruby
i = 20
loop do
for i in 1…20
next if i -= 2 == 0
print i
break if i <= 0
end
<do not remove the three backticks above>
You are supposed to only use loop do
. Mixing two loops together (loop do
and for i in
) is bad.
In the next
statement, your condition has to check if i
is odd (how do you check if a number is odd? ;))
You also have to keep subtracting 1
from i
each iteration so that the break
conditition can be met and the loop hence exited (so that the loop does not become an infinite loop).
1 Like
thanks, I’m sorry \i didn’t see this sooner 
I’m not sure why this isn’t working. Can you give me any hints?
i = 20
loop do
i -= 1
next if i % 2 == 5
print “#{i}”
break if i <= 0
end
Thanks in advanced.
I understand now. I had the wrong remainder for odd numbers divided by 2. Thanks!