"while loop" doesn't start


#1

Hello.
I'm new to this language and do not understand the mistake.
I wrote:

var understand = 0;

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

Why didn't it print the string to the console?


#2

To assign a value to a variable, use =, to check if something is equal to another, use ==, to check if something is EXACTLY THE SAME as another, use ===.


#3

var understand = true;

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

(This worked for me).


#4

Thank you! Really couldn't figure out what it wanted