2/11 I have no idea what I'm supposed to be doing


#1

so i don't really understand while loops and the tutorial says to inset any condition into the loop so i put:
while(understand=0)
and i get "Oops, try again. It looks like you didn't print the string to the console. Check your loop syntax!" and I have no idea what to put in order to print the string. Help please!


#2

You can just put 'understand' in between teh (). That works. (Although I'm not exactly sure why yet)

var understand = true;

while(understand){
console.log("I'm learning while loops!");
understand = false;
}


#3

Try putting a condition into () that will stop the loop running ie: === 0
Then check yr syntax, I had the same problem, but after I reviewed how the computer executes a loop I figured it out.


#4

Hi Pagodacom,

I agree, it's kinda silly that there wasn't a comment about while loops cycling random variables/words such as "understand" (I'm not sure if that's correct). From a beginner's perspective it doesn't make any sense. I entered 'understand' and it appears that using 'understand' is like flipping a coin which would result in random 'true' or 'false' results which give you the solution eventually. It would be nice to see the browser working in the background and how many times it has to cycle, this would help me learn faster. Does anyone else agree?


#5

I tried to explain all kinds of loops here, you might have a look at it:


#6

We mentioned infinite loops in the previous exercise. If you give a while loop a condition that is true and you don't build in a way for that condition to possibly become false, the loop will go on forever and your program will crash. No good!