goto a no-go?
Manu
turkeyman at gmail.com
Tue Oct 1 20:42:02 PDT 2013
On 2 October 2013 03:00, deadalnix <deadalnix at gmail.com> wrote:
> On Tuesday, 1 October 2013 at 16:55:12 UTC, Manu wrote:
>
>> On 1 October 2013 23:54, deadalnix <deadalnix at gmail.com> wrote:
>>
>> On Tuesday, 1 October 2013 at 11:40:35 UTC, Manu wrote:
>>>
>>> Note: there's an un-handled case in your example, but I'll ignore that.
>>>> Anyway, goto is supported. Walter likes it. I use it from time to time.
>>>> I'd say 90% of the time I find goto useful is when I need to bail from
>>>> nested loops. I've often wondered if something like break(2) would be a
>>>> more elegant solution to the breaking out of nested loops problem.
>>>>
>>>>
>>>> BreakableLoop: while(condition) {
>>> while(condition) {
>>> // Stuff . . .
>>> break BreakableLoop;
>>> }
>>> }
>>>
>>> Also works with continue.
>>>
>>>
>> ... O_O
>>
>> Is this D code?
>> I've never seen that. If that works, that's awesome!
>>
>
> Yes, I use it quite a lot ! Very useful construct.
>
Super useful! :)
Well, I think there's almost no reason left for goto... I can't think of
any of my common use cases that aren't satisfied with a proper D construct.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131002/153f34ca/attachment.html>
More information about the Digitalmars-d
mailing list