4 ms·
If you're using break to signal success, that is how else acts.
by eurleif 12y ago
If you're using break to signal success, that is how else acts.
- thatswrong0 12y agoI've been using break to signal failure. I'll keep that in mind.
- maxerickson 12y agoJust to illustrate: >>> for item in (1,2): print(item) else: print('Done!') 1 2 Done! >>> for item in (1,2): print(item) break else: print('Done!') 1 >>> edit: also: >>> for item in (): print(item) else: print('Done') Done