Get value of a variable
Returns value of a variable with the specified name. Accessing variables is a very frequent operation in
thing has also an abbreviated form:
Note, that there is an important rule in POOL:
thing instruction can take at the input any
expression which outputs a word. This instruction should be used when the name of a variable is not known
a priori, e.g. it is a result of function or a value of another variable. The abbreviated form
: can be used only with a constant word provided in the source code.
In most cases names of variables are known constants. Then the short syntax with the colon is convenient and also
the compiler can generate optimized code.
Variables in various scopes can have the same name. In this situation the variable which is accessed is selected
in the following way: local variables are searched for the specified name, then global variables, and shared
variables at the end.
make "x 12.3
print 2 * :x
make "l [a b c]
foreach "n :l [make :n repcount]
foreach "n :l [print thing :n]
Local, global, and shared variables
let, localmake - set or create local variable
make, name - set or create global variable
Table of Content