Loading, please wait...
With the help up of break statement you can stop the loop even if the while condition is true:
Example
Exit the loop when i is 4:
i = 1while i < 6: print(i) if i == 4: break i += 1
output
C:\Users\My Name>python demo_while_break.py123