1. Re: Goto, etc.

On Tue, 16 Nov 1999 08:28:16 -0800, Michael Nelson <mike-nelson-ODAAT at
WORLDNET.ATT.NET> wrote:

>A possible simpler solution to exiting nested blocks with no goto's or labels:
>
>exit could be modified to take an (optional) integer argument (1 assumed if
>omitted).  The agument would specify the number of nesting levels to exit:
>
>--Psuedo-code--
>
>for i=1 to 10 do
>    for j=5 to 25 by 5 do
>        while k<75 do
>            if error1 then exit  end if -- or exit 1
>            if error2 then exit 2 end if
>            if error3 then exit 3 end if
>        end while
>    end for
>end for
>
>when error1 occcurs, only the inner block is exited, when error2 occurs, the
>inner block and the enclosing for block is exited, if error3, then all blocks are
>exited.
>
>This is just an off the top of my head idea--what do you think about it?
>
>--Mike Nelson>

It works and is very similar to something that Ralf had suggested to me..I
think it must have been in a private post. From what he said, it may not
have been from an older discussion on the list. It is not very
self-documenting. I would like to see some way of using a loop variable
as a referent without my strange proc syntax and without creating labels.

Everett L.(Rett) Williams
rett at gvtc.com

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu