Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Undocumented: Index value local to FOR loop

From: nitsch-lists:netcologne at: 24-Mar-2004 1:42

Hi Giuseppe, On Dienstag, 23. M=E4rz 2004 15:50, Giuseppe Chillemi wrote:
> I have found this undocumentend behaviour: > Try this script:
rebol [] esterno: does [ print [indice] ] for indice 1 10 1 [ esterno ] Halt
> Rebol tell me that "indice" is not initalized but it is ! This word seems > to remain local to the for loop.
I quickly step in, even if Greg described the technical: some loops make locals for you implicitely. so for indice 1 10 1 [ esterno ] is the same as use[indice][ for indice 1 10 1 [ esterno ] ] so the global is not changed. and your 'esterno uses the global. thats handy because i usually use the same varname for loopvars, like 'i, and have not to declare it as local. further note: its not consistent, 'forall, 'forskip do not do this. has convenience-reasons too IMHO. Nested foralls, before block-parser was there.
> I suppose the mailing list already know this. I write it for just > confirmation from the community. > > Giuseppe Chillemi
-volker