Game Development Reference
In-Depth Information
Local variables
A local variable is a variable that is local to the code block or script being run at the time of
its creation. At the end of the code block or script it is created in, a local variable is auto-
matically removed from memory.
As a local variable is not initialized in the create event, it must be initialized using the spe-
cial function var .
The following is a sample of two local variables being initialized:
As you can see, the only difference between this and an instance variable is var in front of
the variable name. Once a local variable has been initialized, it can be used throughout the
rest of that code block or script. At the end of the code block or script, the variable will be
deleted.
Search WWH ::




Custom Search