0

While loops for a freshman.

Why does a program finish when I write 'while False'? It starts looping with 'while True', you know. What difference is between these operations? (sorry for my English)

24th Feb 2017, 5:50 PM
Azalea Valeeva
Azalea Valeeva - avatar
1 Answer
+ 1
while loop only executes the code within it if it is evaluated as true. while (false) will be always false and while (true) will be always true.
24th Feb 2017, 5:54 PM
Alex Soh Chye Wat
Alex Soh Chye Wat - avatar