Variables

You will frequently use variables when it is necessary to store values that are subsequently used in your programs. For example, you could calculate two or more values, then compare the results, and subsequently calculate some more. You must use variables to do this.

How variables are used

ViviFire, as do most programming languages, uses variables to store values. A variable has a name that you use to get or set its value. Each variable also has a data type which has limits on what values it can store. Arrays of variables are available when it is necessary to store some related values that you must use together.

Assignment statements

You use an assignment statement to calculate a result, and store the result in a variable. The example that follows shows this.

' Assign the value 10 to the variable
Products_sold = 10
' Increment the variable
Products_sold = Products_sold + 1
' The variable holds the value 11

Note: The equals sign (=) is not the same operator used in algebraic equations. In the example, this is an assignment operator that stores a value in the variable Products_sold.

See also