if-expressions

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 30 06:38:51 PDT 2016


On Tue, 30 Aug 2016 11:58:49 +0000, pineapple wrote:

> On Sunday, 28 August 2016 at 16:17:31 UTC, Cauterite wrote:
>> I dunno man, it seems all backwards to me. If you're gonna do it this
>> way, then you'd also want your if-statements like this:
>>
>> {
>>     foo();
>>     bar();
>> } if (cond);
>>
>> Could you imagine trying to read a function you didn't write yourself
>> if branches were written like that?
> 
> Speaking of which, what's up with D's `do{ ... } while(...);`? Why not
> improve upon the convention and write `dowhile(...){}` or just
> `do(...){}`, or really anything that doesn't put the condition at the
> end?

Placing the condition at the end reflects the fact that the condition is 
executed at the end of the loop.


More information about the Digitalmars-d mailing list