Difference between revisions of "Variable Reference"
→Defining Variables: Added link to expression reference
imported>Cipscis (→Defining Variables: Initialisation outside of functions and events can only be to literals - no expressions) |
imported>Cipscis (→Defining Variables: Added link to expression reference) |
||
Line 11: | Line 11: | ||
You may optionally follow the variable with an equals sign and an expression (in a function) or value (in a script) to initialize the variable with that value on the same line. If you do not give it an initial value, then it will start with a [[Default Value Reference|default value]]. | You may optionally follow the variable with an equals sign and an expression (in a function) or value (in a script) to initialize the variable with that value on the same line. If you do not give it an initial value, then it will start with a [[Default Value Reference|default value]]. | ||
If a variable is declared outside of a function or event, it can only be initialised as a [[Literals_Reference|literal]]. Inside a function or event, expressions can be used in variable initialisations. | If a variable is declared outside of a function or event, it can only be initialised as a [[Literals_Reference|literal]]. Inside a function or event, [[Expression_Reference|expressions]] can be used in variable initialisations. | ||
Variables in scripts do not have to be defined before use, but variables inside functions do. Variables defined in scripts may have [[Flag Reference|flags]]. | Variables in scripts do not have to be defined before use, but variables inside functions do. Variables defined in scripts may have [[Flag Reference|flags]]. |