+ 1

Can someone explain what 'while true' and while false' mean? I mean while what is true?

Question

31st Aug 2019, 6:26 PM
Joy
4 Answers
+ 5
BƂack Jesus😣 If you have that all in a while True loop, considering you used proper syntax (all keywords are lowercase, indentation is correct, print statement was written correctly, etc.), it will run but will create an infinite loop, which wouldn't really be of much use if you're not breaking out of it
31st Aug 2019, 6:55 PM
Faisal
Faisal - avatar
+ 3
while True is a loop that tests the value of the boolean value True, and because it will always satisfy the conditional for the loop, the loop will always run unless it encounters a break statement within it while False will never run as the boolean value False will never satisfy the condition (while loops have to evaluate to True for them to run)
31st Aug 2019, 6:29 PM
Faisal
Faisal - avatar
+ 3
It will endlessly run in silence giving you the impression that your device hangs and is unresponsive.
31st Aug 2019, 10:44 PM
Sonic
Sonic - avatar