6. Solo Flight Error - "Did you log a 'Looped once!' to the console?"



I keep getting a "Did you log a 'Looped once!' to the console?" error message, but from what I can see it looks like I did. I can't figure out what I'm doing wrong. I did try = and === for the condition in the while loop. Any help is appreciated. Thanks!

UPDATE: I figured out that I needed to remove the "false" completely for it to work & just have myCondition by itself. So I got it to work, but I'm not sure that I understand why. In the while loop, don't you have to tell it to keep going until myCondition is false?

var soloLoop = function(){
  //Your code goes here!
  var myCondition = true;
  while (myCondition === false){
      console.log("Looped once!");
      myCondition = false; 



Hi the while condiition should be true

while (condition) {


so you have that in your while condition

(myCondition === false)

which is equal to

(true === false) #result false

since you set myCondition to true so you should change the false with true


Thanks for the quick response. Can you help me understand the condition for the while loop. I thought it was supposed to determine when the loop stops, so wouldn't it be stop when myCondition equals false? Did I misunderstand that?



Yes, but it denpends... In this case the condition will stop the loop

var num = 0;

while (num < 9) {
   console.log("I'm looping")

that while loop will run as long as num is less than 9.
In your case you have true and false since the while loop run as long as the condtion is true to evoid an inifinit loop you should set the condition to false so you shoul do it like that

var myCondtion = true;  #first you set the condition to true

/*the while loop will run as long as the condition is true*/ 
while (mycondition === true) { 
    console.log("Looped once!");
    myCondition = false /*set the conditon to false here to evoid the infinit loop*/

myCondition = false inside the while loop will stop that while loop.