Proposal of a general do-while loop

Christopher Wright dhasenan at gmail.com
Tue Jul 17 19:38:23 PDT 2007


downs palsat:
> void doWhile(void delegate() pre, lazy bool cond, void delegate() post) {
>   while (true) {
>     pre;
>     if (!cond()) break;
>     post;
>   }
> }

More simply:

void doWhile(void delegate() pre, lazy bool cond, void delegate() post) {
    for (pre; cond; pre) post;
}



More information about the Digitalmars-d mailing list