0
While true: statememts
why using true word using while loop doesnt give error? there should be a condition against true word..
2 ответов
+ 2
Putting a condition after the 'while' keyword will return a boolean result ('True' or 'False')...
Putting the keyword 'True' alone after the 'while' is same that putting the condition result...
So 'while True:' is equivalent to 'while 42 == 42', but spare some cpu cycles ^^ (and do an infinite loop, in which you have to handle a base case to break the loop :P)
0
true is not a simple word, it's a keyword.
boolean operators returns true (1) if the condition is true, and false (0) if the condition is false.
you can replace an unnecesary condition with true if you want to make the loop/conditional run always