3/18 Undefined method


#1

counter = 0
until counter >= 10
puts counter
# Add code to update 'counter' here!
i += 1
end
puts i

could someone explain what I am doing wrong here? are there any good tutorial videos to explain this stuff better?
I am having a hard time retaining how to do this stuff. I passed the whole javascript course and I still have problems with simple stuff like this.


#2

I am pretty new at this as well, but I can see the problem with your code. Hopefully I am using the correct terms

Your variable is "counter" (counter = 0). The problem is later in your code you are trying to tell the computer to add 1 to variable i, and put i, which isn't defined in your code. Your i should be "counter".

This is my code that worked, compare it to yours. Hope this helped!

counter = 1
until counter > 10
puts counter
counter += 1
# Add code to update 'counter' here!

end


#3

I agree with your answer alanjv. Interestingly, when I used "counter = counter +1" as opposed to "counter += 1", it should have achieved the same thing, but the code did not pass. Any ideas?


#4

Ignore that. The code did work for the counter increment, I just hadn't changed the other bit of the code the exercise was looking for!