+ 1

I can't seem to understand the meaning behind "while True:" . Is there any other way to obtain the same results?

14th Feb 2018, 8:23 PM
Sanjeev Anand
2 Respuestas
+ 2
"While True:" It's an infinite loop. You can achieve the same by doing this; "while 1 == 1:"
14th Feb 2018, 8:31 PM
Julián González Calderón
Julián González Calderón - avatar
+ 1
As Julián said it is an infinite loop, meaning it will never end. These can be useful when you're trying to iterate through some data without measuring the size, or get input from a user, among other things. Then the break keyword or similar functionality can be used to get out of the loop after input is received or the end of data is reached, etc.
15th Feb 2018, 12:20 AM
Tom Shaver
Tom Shaver - avatar