[REBOL] Re: R: Re: Variable not avilable out of a foreach
From: Izkata::Comcast::net at: 10-Dec-2007 20:12
Probably for a similar reason this C code doesn't work:
#include <stdlib.h>
void Test()
{
printf("Var: %d\n", X);
}
int main()
{
for(int X = 0;X < 10;X)
Test();
return 0;
}
In Rebol, setting a word to some value is a global action unless it's done within an
object. (I may be wrong here, but that's how it seems to work, and how I understand
it) So setting line to something else before calling your function is equivalent in
the above C code to adding a global variable and using that instead of trying to access
X where it doesn't exist.
On Mon, 2007-12-10 at 20:46 +0100, Giuseppe Chillemi wrote: