0

Where we use 'while true' condition

While loop

21st Jan 2019, 4:23 PM
Roshan Pradhan
Roshan Pradhan - avatar
3 Answers
+ 3
Sometimes you don't want or can't define what will be the ending condition of the loop. So by using true, the loop goes on and on. The point is to create an abort condition in the code block instead, using break. For example (in Python since you seem to be studying that): list_ = [] while True: x = input() if not x: break list_.append(x)
21st Jan 2019, 4:56 PM
HonFu
HonFu - avatar
+ 1
Thanks
12th Feb 2019, 6:16 AM
Roshan Pradhan
Roshan Pradhan - avatar
0
For making an infinite loop
21st Jan 2019, 4:33 PM
Etabeta1🇼đŸ‡č
Etabeta1🇼đŸ‡č - avatar