Maxim wants
foreach number [ 8 0 2 4 0 5][
if number = 0 [CONTINUE]
print 100 / number
]
which is not available, but
foreach number [ 8 0 2 4 0 5][
catch[
if number = 0 [throw 'continue]
print 100 / number
]
]
does the trick.
use catch/name , throw/name if you need to catch other stuff too.
-Volker
Am Freitag, 17. Oktober 2003 23:31 schrieb Maxim Olivier-Adlhoch:
> > -----Original Message-----
> > From: Elan [mailto:[EMAIL PROTECTED]
> >
> > The example you bring:
>
> [...]
>
> > could just as well (better? ;-) ) be written as
> >
> > foreach number [ 8 0 2 4 0 5][ [ if number > 0 [ print 100 /
> > number ] ]
>
> I was just keeping the example simple ;-)
>
> > I wonder if the combination of if, either and any, all enables us to
> > cover any and all relevant cases?
>
> they usually do... but nests get deep and it sometimes gets messy to
> edit...
>
> its like if the return word did not exist... sometimes its easier just to
> return a function when we know the rest is pointless...
>
>
> you can often just chain tests one after another... in the end, this is
> slower, but I rarely am able to notice the difference between .1 and .2
> seconds ;-)
>
> I just used a temporary variable instead, like:
>
> ;------------------------
>
> success: true
>
> if whatever [
> success: false
> ]
>
> if unless something else [
> success: false
> ]
>
> if success [
> do
> what
> I
> need
> ]
>
> ;---------------------------
>
> I tried using any and all and in certain situations but in my problem, it
> became overly complex to maintain, so basically, I guess its a case by case
> decision on the method...
>
> having a continue word would allow me to skip the rest of the code whenever
> I find something I know is bad, without having to try and build it up in a
> fancy mutliple level if/either/any/all block.
>
>
>
> -Maxim
--
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.