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


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 ?


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

Use slaying = !slaying to overwrite the value.


ok thanks I understand the difference now.