Many thanks to Izzy Boy, Sunanda & Cyphre

I think the Cyphre's "catch" approach is what I'm looking for, cool!

Sunanda:
> Though in many cases refactoring the code may lead to a more elegant
> structure.

Absolutely in agreement.


cheers
Alberto


On Wed, 17 Aug 2005 03:14:57 -0500, Cyphre <[EMAIL PROTECTED]> wrote:

>
> Hi all,
>
> this is another possibility:
>
> items:  [1 2 3 4 5 6 7 8 9]
> foreach i items [
>  catch [
>   print i
>   if i // 2 = 0 [throw]
>   print ["  " i "is odd"]
>  ]
> ]
>
> rgeards,
>
> Cyphre
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, August 17, 2005 9:24 AM
> Subject: [REBOL] Re: Iterations question
>
>
>>
>> Albert:
>>
>> > Is there a way to force the next iteration within loops?
>>
>> One way is to wrap a loop 1 around the loop and then use break to exit  
>> the
>> loop 1.
>>
>> foreach item [1 2 3 4 5 6 7 8 9] [
>>    loop 1 [
>>        print item
>>        if item // 2 = 0 [break]
>>        print ["  " item "is odd"]
>>        ]
>>    ]
>>
>> Though in many cases refactoring the code may lead to a more elegant
>> structure.
>>
>> Sunanda.
>> --
>> To unsubscribe from the list, just send an email to
>> lists at rebol.com with unsubscribe as the subject.
>>
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to