[REBOL] Re: Undocumented: Index value local to FOR loop
From: greggirwin:mindspring at: 23-Mar-2004 11:04
Hi Giuseppe,
GC> I have found this undocumentend behaviour:
GC> for indice 1 10 1 [esterno]
GC> Rebol tell me that "indice" is not initalized but it is ! This word seems to
GC> remain local to the for loop.
Yes, FOREACH and REPEAT work the same way. FOR is a mezzanine, so you
can see how it works--though it is a bit advanced if you happen to be
new to REBOL.
Look at the core docs (e.g. core.pdf) at how you can define
literal-arguments and get-arguments for functions. REBOL uses
'definitional scoping', which may seem a bit confusing at first when
used with literal arguments.
>> fn: func ['word] [print word word: 10 print word]
>> fn hello
hello
10
>> hello
** Script Error: hello has no value
** Near: hello
HTH!
-- Gregg