Re: Euphoria features
> ---------------------- Information from the mail
header -----------------------
> Sender: Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
> Poster: "Cuny, David at DSS" <David.Cuny at DSS.CA.GOV>
> Subject: Re: Euphoria features
> --------------------------------------------------------------------------
-----
<SNIP>
>
>
> Would work. But there are 'while' loops as well. I suppose you could add
> labels to the loops, as in:
>
> outerWhile: while true do
> for i = 1 to 10 do
> ...
> leave outerWhile:
> ...
> end for
> end while
Hmm, Exiting while loops does pose a bit of a problem.
This will definately require even more consideration.
> This strikes me as being less clear than the pure GOTO, and it disallows
> instance where you have a series of instructions, but want to stop if an
> error is encountered:
>
> if handle = -1 then
> goto fileError:
> end if
>
> ...
> if writeResult = -1 then
> goto fileError:
> end if
>
> ...
> if closeFileResult = -1 then
> goto fileError:
>
> ...
> return
>
> fileError:
> ...
> return
>
>
> Yes, I know that you could set a flag, etc. But it still seems to me that
> the GOTO best expresses the intent of the code: if an error is
encountered,
> skip the rest of the code and run the error handler.
>
> -- David Cuny
>
David, That would be a GOSUB.
Basic's "ON ERROR GOSUB Label" comes to mind
What does this mean? It means I would use a subroutine to handle it
in the first place.
procedure fileError()
--Handle the file Error.
if can_not_handle then
abort(err_code)--
end if
end procedure
if handle = -1 then
fileError():
end if
...
if writeResult = -1 then
fileError():
end if
...
if closeFileResult = -1 then
fileError():
end if
PS: No, My idea of exit(A) or exit[A] isn't mimicking others
similar ideas. I simply had not read those messages
before forming that thought. Same with my other near
identical response to a previous message.
As usual, someone seems to beat me to the punch.
Lucius L. Hilley III
lhilley at cdc.net lucius at ComputerCafeUSA.com
+----------+--------------+--------------+
| Hollow | ICQ: 9638898 | AIM: LLHIII |
| Horse +--------------+--------------+
| Software | http://www.cdc.net/~lhilley |
+----------+-----------------------------+
|
Not Categorized, Please Help
|
|