What languages have a while-else type control structure, and how does it work?
Posted
by Dan
on Stack Overflow
See other posts from Stack Overflow
or by Dan
Published on 2010-04-01T15:33:42Z
Indexed on
2010/04/01
15:43 UTC
Read the original article
Hit count: 332
A long time ago, I thought I saw a proposal to add an else
clause to for
or while
loops in C or C++... or something like that. I don't remember how it was supposed to work -- did the else
clause run if the loop exited normally but not via a break statement?
Anyway, this is tough to search for, so I thought maybe I could get some CW answers here for various languages.
What languages support adding an else
clause to something other than an if
statement? What is the meaning of that clause? One language per answer please.
© Stack Overflow or respective owner