MartinjHere's a quick example:
$_globalvariable is declared global, so it is "visible" not only to the main script, but to all functions and other called scripts ... available everywhere
$localvariable is "dimmed" only within the function myfunction(), therefore it's scope is local and can NOT be referenced outside that function. This rather poor example demonstrates that one can access a global variable $_globalvariable from anywhere, but a local variable ($localvariable) only from within the function (it's dimmed in the function) ... because it's local to the function, this variable can have any name you want (which is a good thing) ...
code:
break on
global $_globalvariable
$_globalvariable = "global"
myfunction()
?"local=" $localvariable ; this doesn't work, $localvariable doesn't exist
?"global=" $_globalvariable
exit 1
function myfunction
dim $localvariable ; <--- here's the local DIM
$localvariable = "local"
?"local=" $localvariable
?"global=" $_globalvariable
endfunction
-Shawn
[ 14 November 2001: Message edited by: Shawn ]