Feature request: extending comma operator's functionality

monarch_dodra monarchdodra at gmail.com
Fri Oct 5 08:32:03 PDT 2012


On Friday, 5 October 2012 at 15:35:31 UTC, Don Clugston wrote:
>
> My feeling is that  do{}while() is a fairly useless concept...
> [SNIP]

The most frequent use I have for do while is to hack it to 
construct break-able blocks actually ^^ :

//----
do
{
     if(!condition1) break;
     if(!condition2) break;
     if(!condition3) break;
     if(!condition4) break;
     //DO SOMETHING
}while(false);
//----

It is a nice way to avoid the dreaded 
"if(if(if(if(if(if())))))))" triangle.

Related:
http://d.puremagic.com/issues/show_bug.cgi?id=8622


More information about the Digitalmars-d mailing list