what is this while true statement in python? Can someone explain?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is this while true statement in python? Can someone explain??

while true Condition

27th Sep 2018, 3:30 PM
Ajay B
2 Answers
+ 1
It execute the loop infinitely times then for exit you have to have some condition inside it for break... At example: x= 1 while True: if x==10: #this break the loop saving you from infinite loop break # This also is important else break will not never reached x+= 1
27th Sep 2018, 3:55 PM
KrOW
KrOW - avatar
+ 1
while (condition): .... executes the indented blok of code as long as the return of the condition is True. examples: while (x <= 3): returns True for x <=3 and False for x >3 while (1 < 7): always returns True while (True): is the same as the previous example as the condition = True
27th Sep 2018, 4:59 PM
davy hermans
davy hermans - avatar