You will often need to store values for later use in your programs. For instance, you may need to perform two or more calculations then compare the results and subsequently perform further processing. You need variables to do this.


ViviFire, like most programming languages, uses variables to store values. A variable has a name that you use to get or set its value. Every variable also has a data type which determines what sorts of values it can store. Arrays of variables are available when you need to store several closely related values that must be processed together.

Assigning values

You use an assignment statement to perform a calculation then assign the result to a variable, as the following example shows.

Listing 1
' Assign the value 10 to the variable
software_sold = 10
' Increment the variable
software_sold = software_sold + 1
' The variable now holds the value 11

Do not confuse the use of the equals sign (=) with its use in algebraic equations. In the example, this is an assignment operator that stores a value in the variable software_sold.

Variables and property syntax

ViviFire supports a statement whose syntax closely resembles the above assignment syntax, but is more complex. Referred to as "property syntax", it causes a block of code to execute every time a value is assigned a value, thus giving you greater control over the variables in your code.

For more information, see Differences Between Properties and Variables.

See also