3. The 'While' Loop. Just a basic question


#1

Why can't we write !slaying; in the body of the 'while' loop statement ? isn't it the same as slaying = false; ?

var slaying = true;

while(slaying) {
slaying = false; // !slaying ?
}


#2

!slaying is false, but it doesn't change slaying to false.

Use slaying = !slaying to overwrite the value.


#3

ok thanks I understand the difference now.