Thanks for catching my mistake. I meant to say that variables are global by default.
You changed things when you invoked the Here name space. I modified your script to illustrate the global name space in effect:
// Names Default To Here( 1 );
Delete Symbols();
fn1 = Function( {x},
fn2 = Function( {x},
2*x;
);
5*fn2(x);
);
Show Symbols();
y = fn1(10);
Show( y );
Show Symbols();
The Log shows:
// Global
fn1 = Function( {x},
fn2 = Function( {x}, 2 * x );
5 * fn2( x );
);
// 1 Global
y = 100;
// Global
fn1 = Function( {x},
fn2 = Function( {x}, 2 * x );
5 * fn2( x );
);
fn2 = Function( {x}, 2 * x );
y = 100;
// 3 Global
So fn2 is also a global variable, by default. You must indicate that you prefer the exception, a local variable, when necessary.