goto a no-go?

Jakob Ovrum jakobovrum at gmail.com
Tue Oct 1 05:06:21 PDT 2013


On Tuesday, 1 October 2013 at 11:22:12 UTC, Chris wrote:
> Is it ok or even necessary to use goto in D?

It's best viewed as a compatibility or micro-optimization 
feature. For structuring code, D obsoletes goto with nested 
functions, scope statements and labelled break and continue.

Most experienced D programmers use scope statements and labelled 
break/continue to replace goto with great effect, but sometimes 
the same programmers can still be seen using goto when a nested 
function would really have solved the issue more structurally, so 
I recommend experimenting with nested functions if they are 
unfamiliar to you.



More information about the Digitalmars-d mailing list