+ 1
I can't seem to understand the meaning behind "while True:" . Is there any other way to obtain the same results?
2 odpowiedzi
+ 2
"While True:"
It's an infinite loop.
You can achieve the same by doing this;
"while 1 == 1:"
+ 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.