|
This is a great question. But there's more to the story ... the "scope" rules for included files versus called files are different. Called and included are "kinda" the same, yet very different.
Think of include files as code that is "inserted" or "injected" right into your main code, right where you put the include. Where as called files are "jumped to" and maintain a seperate scope.
Two important differences (for example) are DIM'ed variables and the EXIT statement.
Variables DIMed in a called script are not visible to the parent script that "called" it - the scope is local to the called script. Variables DIMed in an included script are available to the "parent" script - because the included script was simply injected right into the parent script, and the interpretor treated it as part of the main script.
Using the EXIT command in a called script exits the called script (scope again) ... using EXIT in an included script causes the parent script to exit (because again, the included script gets processed as if it was the main script).
Confusing I know ...
-Shawn
|