Inspiration and influence of the else clause of loop statements?

Posted by Aristide on Stack Overflow See other posts from Stack Overflow or by Aristide
Published on 2010-05-27T20:06:03Z Indexed on 2010/05/28 14:11 UTC
Read the original article Hit count: 197

Filed under:
|
|
|

Python offers an optional loop-else clause which is executed if and only if the loop is not terminated by a break. (In other words, the condition fails for a while-loop or the iterator is exhausted for a for-loop.)

Does this loop-else construct originate from another language? (Either theoretical or actually implemented.) Has it been taken up in any newer language?

Maybe I should ask the former of Guido, but surely he is too busy for such a futile inquiry. ;-)

Related discussion and examples: Pythonic ways to use ‘else’ in a for loop

© Stack Overflow or respective owner

Related posts about python

Related posts about loop