gameExit = False

0 Q Street · May 23, 2015
Hi and thanks so much for these great tutorials.

I don't follow.  You set gameExit = False. So far so good.

then you set a while loop as NOT gameExit.  Isn't not, the opposite of the state of gameExit. i.e. if you have set gameExit to False, then NOT would be true, no?

later in the code, you entered gameExit = True is such and such happens.

What i don't understand is, for the purposes of that while loop, isn't gameExit 'true' because you said while it is NOT false?

Thanks again.

Post a Reply

Replies

Oldest  Newest  Rating
0 K D · May 24, 2015
a while loop only runs while a condition is True which means it would never run if he said while(gameExit) because of the fact that gameExit is equal to False so by saying while(!gameExit) he ensures that it will run until gameExit is equal to True.

i dont remember if python uses ! or not sorry
0 Eyeshield Rosalin · May 24, 2015
There's nothing wrong, you can do it vice versa


while gameExit = =True:
       #run code here forever

#when it's done or event.QUIT:

#get out of the loop
gameExit = False


while gameExit = =False:
       #run code here forever

#when it's done or event.QUIT:

#get out of the loop
gameExit = True

#It depends on how you use them :)
  • 1

Python

107,132 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator