[REBOL] loop on block
From: al::bri::xtra::co::nz at: 21-Jan-2002 20:38
Charles wrote:
> My problem, usually, has been that when using a for loop on a series which
gets altered, the loop fails to access the altered series/block, but
continues to use the original. How do I go around this? (Ie, if I have [a
b c d] and I run a for loop through it, when the loop reaches c, I want to
append [e f g] to the block, and continue running the loop through e f g...)
Try:
Items: [a b c d]
foreach Item Items [
probe Item
if 'c = Item [
append Items [e f g]
]
]
Similar procedure should work for 'for, but I prefer using 'foreach.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/