In JSL, a variable, lets use your example of a variable called "i" is described as
namespace:i
If nothing is specified to set a namespace, the formal specification is:
::i
Since the default namespace in JSL is a namespace named ":"......pretty wierd, but there are historical reasons for this. So if you enter in
i = 7;
What JMP is seeing is:
::i = 7;
So, now if in any part of a JSL script, the variable i is changed, and then referenced later on, it will have the new value
showit = Function( {I},
Show(I);
);
I = 2;
showit(I);
I=3;
showit(I);
it returns
I = 2;
I = 3;
Now, a function can isolate a variable, by making the variable local to the function
showit = Function( {I},{I},
I=55;
Show(I);
);
I = 2;
showit(I);
show(i);
The result of this code is:
I = 55;
i = 2;
notice, that the value of i for the global use of it has not changed.
Now for some final confusion:
When I said that the value of i can be changed, and all subsequent uses of i will reflect that change, that means it will be changed even in different scripts that are being run. So if a new script is run that has the variable i in it, it will have the value of the i that was set in the previous JSL script. Thus, the statement "Names Default to Here( 1 );" was implemented. This statement does 2 things. First, it changes the namespace from ":" to "Here". Seconly, it isolates all of the variables in the "Here" namespace to only the variables in the script that is being run. So now, if you have the following script
Names Default to Here( 1 );
i = 7;
this instance of the variable i will only be changed by the usage of i within the script.....no other script will have access to the changing of that variable i.
P.S. The formal description of the variable i is:
here:i
and any variable in the script that is created in the script, after the "Names Default to Here( 1 );" statement will automatically be placed into the namespace call Here.
Jim