[ColorForth] How to escape from loops
- Subject: [ColorForth] How to escape from loops
- From: Alex Thiel <alex.lists@xxxxxxxxxx>
- Date: Thu, 18 Jul 2002 00:02:48 +0200
On Wednesday 17 July 2002 23:30, Alex Thiel wrote:
> Hello,
>
> I can't seem to figure out how to escape from a FOR loop properly if some
>
> exceptional condition occurs. I want to write something like this:
> : loop for cond? if default next ; then exception ;
>
> After "exception" has been executed, the loop should terminate. I guess I
> have to shuffle the return stack a bit for this to work, but I don't know
> how.
>
Don't bother - I found it myself:
: loop for cond? if default *next ; then excpt pop drop ;
or, if the logic of cond? is inverted,
: loop for cond? if excpt pop drop ; then default next ;
Alex
------------------------
To Unsubscribe from this list, send mail to Mdaemon@xxxxxxxxxxxxxxxxxx with:
unsubscribe ColorForth
as the first and only line within the message body
Problems - List-Admin@xxxxxxxxxxxxxxxxxx
Main ColorForth site - http://www.colorforth.com
Wiki page http://kristopherjohnson.net/wiki/ColorForth
ColorForth index http://www.users.qwest.net/~loveall/c4index.htm