Add/Edit Instance Variable dialog

The Add/Edit Instance Variable dialog allows you to set the name, type and initial value for an instance variable in an object type. It can be opened from the Object Instance Variables dialog.

Instance Variables dialog

The Name identifies the instance variable. This is typed in to expressions after the object name (e.g. Sprite.MyVariable) to retrieve the value of the instance variable. Some names cannot be used if they conflict with the names of the object's other expressions or behaviors.

The Type specifies what kind of value the variable holds. An instance variable can store a Number, Text (also known as a string) or a Boolean (a simple on or off value, sometimes also known as a flag). The type of an instance variable does not change - for example, you can't store text in a Number variable.

The Initial value is the initial number for a Number variable, the initial text for a Text variable, or true or false for a Boolean. Initial text can be empty. The initial text entered here does not need double quotes around it. In other words, Hello is a valid entry, and if you enter "Hello" the initial string will include the double quotes. Note this is different to entering strings in expressions which require the double quotes.

The Description is an optional comment you can use to briefly describe what the variable is used for. It is displayed next to the name in the editor to help remind you what to use the variable for. It is also displayed in the Properties Bar description panel when the instance variable's property is selected.

Tags: