1. Re: Goto, etc.

ok. but PLEASE replace the 'exit' keyword by a 'break'.  many languages have
adopted some 'standards':
exit = get out of a program;
return = out of a procedure/function
break = out of a loop
IMO the readability and easy access to the language is also due to the fact
that  the keywords are well-known by programmers.
[wow- not a word about goto!]
Riwal Raude
rauder at thmulti.com
> -----Original Message-----
> From: Michael Nelson [SMTP:mike-nelson-ODAAT at WORLDNET.ATT.NET]
> Sent: Tuesday, November 16, 1999 5:28 PM
> To:   EUPHORIA at LISTSERV.MUOHIO.EDU
> Subject:      Re: Goto, etc.
>
> 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
>

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu