Counting with Loops explainer

Great job, Helper. This really made it all slot into place is my mind.

At first I thought the varying i values were creating some sort of an array of instructions. Something that I couldn’t wrap my head around.

I feel like this exercise could benefit from an optional “extra info” tab or something along those lines to help explain the for command’s syntax.

Oops. Just realised that’s what the above text is explaining. Strangely though, it took the second explanation in order for me to be able to understand the first.


Hi everybody and olso you’d better use thé grasshopper patch and dont use your KEYBOARD to Wright the code and getting

I typed ‘i’ like a total bozo. Im a lost cause, guys…

@grasshopperexplainer I want to understand that we initially put i = 0 so when the code runs for the first time it should print 1 instead of (zero) 0 because we added +1 in the bracket ?
I’m abit confused how it prints 0 ? When the print function is after i = i+1

This post explains why the first print is 0.

It’s important to know when each part of the for loop actually runs:


1 Like

You should be more pedagogic.
This is boring.

I tried it by putting a string there, print( ‘var = I’)
Didn’t work, it’s a string.
Then I typed in print (‘i’), didn’t work. It’s still a string, because of the ’ ’
Then I typed print (i) , and it worked.

I hope this helps.

1 Like

Hey there, you’re printing the string 'i' instead of the variable i. Try deleting the string, then use the i key on the keyboard to place the variable inside the () of the print() statement.

Hope this helps!

All you have to do is change the < 2 to < 8
You dont have to put print(i)

1 Like

I agree with this, I think the instructions need to be rewritten. I understand the title is called Counting with Loops so the goal is to loop through 10 times but I feel as though the written instructions don’t reflect this.

Yeah this question that I am on is kinda hard and i went here for help and put the code they gave me on grasshopper but it kept on putting i instead or numbers.

The task says to run the code cyclically until the variable i becomes equal to 10, but the tests expect 10 iterations of the code, which contradicts the first part, because the variable is equal to 10 only for i <11 or i <= 10. I have been writing in JS for a long time and I decided to take a course for the certificate and additional practice, did not expect that this task will puzzle me

Hey there,

i is initially set to 0, so it runs 10 times total, printing out the numbers 0 through 9.

On the 11th iteration, i is 10, which means i < 10 is now false. This causes the loop to stop running.

Hope this clarifies things!

I beleive if yoou use the var func.

Thank you, malady :cowboy_hat_face: * tips fedora *