First time here? Check out the FAQ!
answered 10 years ago
Here are two example functions illustrating breaking out of while and for loops:
def f(): index = 0 while True: print index index += 1 if index >= 4: break def g(): for i in range(10): if i >= 5: continue print i