|
||||||||||||
|
|
||||||||||||
VariablesVariables can be declared inside scripts (known as module variables) and classes (known as member variables).
Similar looking variable "pseudo declarations" can also occur inside functions, having slightly
different meaning. Default behaviour inside functions is to refer to an already
declared entity, and if none is found, new local variable is declared inside function.
Sometimes this behaviour needs to be overridden: placing `` If initializer expression evaluates to constant value at compile time it is called static initializer, otherwise it is called non-static initializer. Typically expression involving only operations between literals evaluates to constants.
All entities referred before initialization contains `` Module variables: Non-static initializer of module variables (and constants) are placed into hidden initialization function in order of declaration, depth first when descending into classes and interfaces. Therefore it is important to maintain the order of declarations such that referred entity is declared before referrer. Member variable: Member variable are initialized in the beginning of constructor, before call to super class constructor. Local variable: Local variables are initialized during the first assignment. variable := "var" variable-decl ( "," variable-decl )* ";" variable-decl := symbolname [ "=" exprinitializer ]
|
||||||||||||
|
|
||||||||||||