goto a no-go?
Chris
wendlec at tcd.ie
Tue Oct 1 04:35:34 PDT 2013
On Tuesday, 1 October 2013 at 11:26:54 UTC, Dicebot wrote:
>> // ...
>> if (word.length == 1) goto FormatOutput;
>>
>> // if word.length > 1, some extra work has to be done
>> // initialize some variables, parse, do some processing etc.
>>
>> FormatOutput:
>> // .....
>>
>> return output;
>
> Have never felt need to use `goto` since got familiar with
> `scope(something)` : http://dpaste.dzfl.pl/ca40b3b6
>
> ;)
Thanks, this is what I was looking for, a more elegant solution.
I was going through some old code and saw the odd goto statement.
scope() shows of course that some sort of goto mechanism is
pretty handy (no matter what the textbooks say).
More information about the Digitalmars-d
mailing list