goto a no-go?

John Colvin john.loughran.colvin at gmail.com
Tue Oct 1 04:47:36 PDT 2013


On Tuesday, 1 October 2013 at 11:40:35 UTC, Manu wrote:
> 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.

labeled statements to the rescue!

	outer: foreach(i; 0..10)
	{
		foreach(j; 0..10)
		{
			break outer;
		}
	}


More information about the Digitalmars-d mailing list