Defining variables

(Difference between revisions)
Jump to: navigation, search
m (1 revision)

Latest revision as of 14:25, 20 June 2011

<var> as <type> [= <value>]

Define a variable

Please also see:



A variable name
One from any of the valid Data Types, such as integer, string, noderef, noderef of class <type>, etc.
(optional) The value or Expression to which to initialize the new variable


This command is multi-purpose. It can be used to define a variable, or a noderef.

  • n as noderef of class <classname>
  • n as noderef (or simply: n as noderef)
If this method is used, meaning no class is specified, it is important to remember that fields on that noderef cannot be accessed unless the noderef is first classified with a WHERE statement to specify which class that it is.

Important: Defining a node does *not* create a node. It only defines a reference to an existing node. To create a node, it is necessary to use a special function such as CreateNodeFromClass(<class>). Please see the section on Built-in_Functions for more information. Even then, a node can have any number of classes on it, though the first one it is created as is its "base class".

Classes cannot be defined with this method, since they are in the DOM (Data Object Model). To define a class, it is necessary to use the CLI and the CCD command (for Create Class Definition).

NOTE: There is also a special case of defining a variable to be a class, even though it is not a node reference. For more information on this, please see the section on Class Level Assignment.


a as int 
foo as Vector 
fud as Noderef of class Vector 
backpackref as noderef = CreateNodeFromClass("container")
a as integer = 7
n as noderef of class GUIcontrol
n.visible = true
n as noderef
where n is kindof GUIlabel   
  n.text = "hi there"

Additional Information

Personal tools