Loop iterator - example.txt

Alexander Panek alexander.panek at brainsware.org
Mon May 1 06:30:26 PDT 2006


Chris Miller wrote:
> On Mon, 01 May 2006 05:36:56 -0400, Bruno Medeiros 
> <brunodomedeirosATgmail at SPAM.com> wrote:
> 
>> Hum, now that you mention it, what if goto could only jump to labels 
>> that are lexically visible in the current scope, using the same rules 
>> as   variables. Seems to me it would make goto more safe, but is such 
>> behavior acceptable? I mean, is there a reasonable use scenario for 
>> goto that requires a cross-scope jump? (I wonder if any of the cases 
>> presented by Walter would require such thing)
>>
> 
> C# has a restriction similar to this and it's pretty annoying.
> 
> if(something)
>    goto mylabel;   // error, mylabel not in scope.
> stuff();
> if(somethingelse)
> {
>    mylabel:
>    morestuff();
> }
How about:

if ( !something ) {
	stuff( );
} else if ( somethingelse ) {
	morestuff( );
}

?



More information about the Digitalmars-d mailing list