2/18 undefined method `+' for nil:NilClass


#1

i = i + 1
while i < 5
puts i
# Add your code here!

end

This is my code and it passes but the console logs undefined method.
Why am I passing if the code does not work?


#2

I believe you should have your incrementation inside of the while loop. So re-arrange it like this.

i = 0
while i < 5

puts i.
# Add your code here!
i = i + 1
end

#3

Thank you for that. But why am I being passed for doing it wrong?


#4

I assume it's due to the fact that the lessons aren't perfect. Remember all of these lessons are in the Alpha stages, back when I first took the JavaScript courses three years ago it was so much different than it is today. It's a progression thing and it'll take a while to get rid of all the bugs.