Syntax error


#1

The console says that I have an unexpected token ) but I can't find the problem

var snow = true
while(snow = true) {
    console.log("It is snowing!");
    snow = false;
};
var cold = 0
for(cold = 0; cold < 5; cold++) {
    console.log("It is cold out!");
};

#2

a single equal sign means assign, it doesn't check if two values are equal


#3

Okay, I changed it to while(snow) and it worked! Thanks!


#4

that is also valid, you understand why? For checking if things are equal, you could use 2 or 3 equal signs


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.