2. While syntax, My code goes through but I don't know if i did it right


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

https://www.codecademy.com/courses/javascript-beginner-en-ASGIv/0/2?curriculum_id=506324b3a7dffd00020bf661
<In what way does your code behave incorrectly? Include ALL error messages.>
Hi, my code goes through the console, but I don’t think it is right. I’m pretty sure it is supposed to print out “I’m learning while loops!
true”
But it actually prints out “I’m learning while loops!
false” This could be right but I’m not sure. Thanks!
<do not remove the three backticks below

var understand = true;

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


#2

Hi you dont need to put understand equal to true, so remove it


#3

That is just something the console does, neither false or true should normally be printed.

Now it is false, because that is the value of understand in the end. But nothing to worry about.

@wizmarco, i agree, but both methods work, did you read the question?


#5

Ok, thanks :slight_smile: