1. tutorial // scope diagrams
- Posted by _tom (admin) Jun 27, 2017
- 1089 views
Thanks to Derek Parnell for making it possible to upload images
Variable
You must first declare the variable (as atom, integer, sequence, or object ) and then assign a value. The variable is then in scope to the end of the file.
Routine
Once a routine (procedure, function, or type) is declared it is in scope for the entire file.
The routine is even in scope inside the routine itself. You can write code that is recursive, calls other routines, and even makes an endless loop like this example:
routine minispace
A routine creates is own space for scope. You can declare variables here that last just to the end of the routine.
include and export
If you include a file the identifiers at first are invisible to the including file. But, if you export (public, or global) an identifier, then it will be visible to the including file. The basic rules for variables and routines apply once again to these identifiers.
The "export space" exists only between these two files. If you want to share files between more included files you must create more export|include relationships.