goto a no-go?

monarch_dodra monarchdodra at gmail.com
Wed Oct 2 10:28:22 PDT 2013


On Wednesday, 2 October 2013 at 17:06:40 UTC, Dicebot wrote:
> On Wednesday, 2 October 2013 at 16:12:58 UTC, Jesse Phillips 
> wrote:
>>    if (word.length)
>>        scope(exit) FormatOutput();
>>
>> This is the same as
>>
>>    if (word.length)
>>        FormatOutput();
>>
>> The `if` introduces a new scope, thus running the code right 
>> away.
>
> Oops, shame on me. Too many `static if`s in my life :(

I think it might be a common mistake? I remember making a similar 
error by placing a scope(exit) in a for loop, hoping they'd all 
get run when leaving the function.


More information about the Digitalmars-d mailing list