Ideas regarding flow control and loops

Robert Fraser fraserofthenight at gmail.com
Sat Nov 3 17:41:00 PDT 2007


Marco Aurélio Wrote:

> 2 - for .. finally, while .. finally:
> 
> This would allow having something like:
> 
> while(someCondition)
> {
>     DoSomething();
> } finally {
>     DoOtherThing();
> }
> 
> The "finally" block would be called at the end of the repetition, only if no "break" was used. This may not seem useful at first, but I think can reduce the number of flags needed to implement various algorithms, making the code faster and more elegant. I'm not sure if this is already possible with scope guards.
> 
> That's it.. What do you think?

Another "eh"... I just can't see its limited use justifying the added complexity.




More information about the Digitalmars-d mailing list