# Metadata
Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android Introduced: 1.0 Security:
# Syntax
global variableNameList
# Params
- variableNameList : A list of global variables separated by commas.
# Examples
global gUserName
global gThisThing,gThatThing,gTheOtherThing
# Description
Use the global command to define a variable that can be used in any handler, and which retains its value between handlers.
You can place the global command either in a handler, or in a script but outside any handler in the script:
* If you declare the global in a handler, the global declare must appear in each handler in which you use the global. If you declare a global in one handler, and try to use it in another without first declare it in that handler, the second handler treats it as a local variable, and it does not retain its value between handlers.
The global command can appear anywhere in a handler, as long as it's before the first statement in which the global is used. However, to make them easier to find, all global declare are usually placed at the beginning of a handler :
* If you declare a global command in a script, but outside any handlers in the script, the global can be used by any handler that comes after the global declare in that script. You don't need to declare such a global again in the handler itself.
Such global commands are usually placed at the beginning of the script, before any handlers, to make them easy to find:
# Tags
# See