Loop iterator - example.txt

Chris Miller chris at dprogramming.com
Mon May 1 13:23:37 PDT 2006


On Mon, 01 May 2006 09:30:26 -0400, Alexander Panek  
<alexander.panek at brainsware.org> wrote:

> 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( );
> }
>

Not the point, this is a small example that isn't real; besides, check  
your logic (something=false; somethingelse=true;)



More information about the Digitalmars-d mailing list