>-----Original Message-----
>From: Przemyslaw Czerpak [mailto:dru...@acn.waw.pl] 
>Sent: Monday, May 25, 2009 9:40 PM
>To: Harbour Project Main Developer List.
>Subject: Re: [Harbour] exit with switch and for each
>
>On Sat, 23 May 2009, Vailton Renato wrote:

[...]

>The same is for many other constructions, f.e.:
>
>   l := 10
>   while f1( l )
>      l *= 10
>      for i := 1 to 100
>         if f2(i)
>            exit  // but I want to exit from WHILE not only from FOR
>         endif
>      next
>   enddo
>
>You can write the same also about nest statments like:
>
>   for i := 1 to 10
>      for j := 1 to 20
>         if f( i, j )
>            exit  // but I want to exit from external FOR i := 
>... loop too
>         endif
>      next
>   next
>
>In short words you are requesting about GOTO instruction which 
>introduces to compiler serious limitations or at least 
>additional code necessary to make it working correctly with 
>statements which needs to allocate and then free some 
>resources. It's rather bad idea.

This is not comparable. Exit was escape from loop without control
expression, loop with control. 
Now, when mixed syntax switch and any while/for we still heve LOOP
inside switch, but EXIT no longer.
EXIT in the sense : escape from a loop.
In this case word Exit important changes.

My example for workaround :

Local lExit := .f., i := 1

While !lExit
 ... // designate i 
 Switch i
 Case 2
   ... // designate lExit
   Loop
 Case 3
    ...
    Exit 
 Case 4
   ....
 End
End

Hm, maby this is ok.. In C is to only break and continue.

Regards,
Marek Horodyski
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to