Syntax for GLOBAL, LOCAL and STATIC
Posted: 20 Nov 2019, 11:28
The documentation for GLOBAL, LOCAL and STATIC commands (statements?) is not very clear.
1. There is no EXPLICIT syntax shown for these statements
From reading the documentation, I do not know
a. Can I have more than one GLOBAL/LOCAL/STATIC statement in a function?
b. Can such statements define more than one variable?
I can INFER the answer to B because an example shows:
2. I don't understand why STATIC, LOCAL and GLOBAL are not given the status of COMMANDS (and, thus, are not given their own syntax boxes).
1. There is no EXPLICIT syntax shown for these statements
From reading the documentation, I do not know
a. Can I have more than one GLOBAL/LOCAL/STATIC statement in a function?
b. Can such statements define more than one variable?
I can INFER the answer to B because an example shows:
However, I should not have to make INFERENCES about how things work.SetDefaults(){
global ; This word may be omitted if the first line of this function will be something like "local MyVar".
MyGlobal := 33 ; Assigns 33 to a global variable, first creating the variable if necessary.
local x, y:=0, z ; Local variables must be declared in this mode, otherwise they would be assumed global.
}
2. I don't understand why STATIC, LOCAL and GLOBAL are not given the status of COMMANDS (and, thus, are not given their own syntax boxes).