Proposal of a general do-while loop
janderson
askme at me.com
Sat Jul 21 11:29:08 PDT 2007
Gregor Richards wrote:
> while ((pos = text.find(pattern, pos)) != string::npos) {
> ...
> }
>
>
> Yeesh.
>
> - Gregor Richards
I agree this is the best way to solve this particular problem. How much
different is?
while ((pos = text.find(pattern, pos)) != string::npos) {
...
}
from
do {pos = text.find(pattern, pos)} while (pos != string::npos) {
...
}
do/while may be more neat if you have more then one pre-condition however.
More information about the Digitalmars-d
mailing list