You can assign a value to each variable that you have previously defined in the declaration section of your program. You can also assign a value to the special variable Result, which is created automatically for every program.

A value assignment consists of two parts:

▫       The name of the variable that you want to store the value in

▫       The expression that calculates the value that you want to store

What kind of expression you use depends on the type of variable. That means that you can only use numeric expressions to assign values to a numeric variable, and Boolean expressions to assign values to Boolean variables. This is because the result of a numeric expression is always a number, and only numeric variables can store numbers. Likewise, only Boolean variables can store the logical values True or False that are the result of Boolean expressions.

Expressions can contain numbers (constants), other variables, parameters, functions and operators. For details about formulating expressions see:

▫       Numeric Expressions

▫       Boolean Expressions

To assign a text value to a Text variable, just put quotes around the text. You can also append numeric data to a text variable by using the + operator.

Syntax

Variable = Expression;

Variable

Name of the variable that you want to assign a value to

Expression

Expression that calculates a value that you want to store

Examples

Assign a simple value to a Numeric variable:

NumOfMonths = 12;

Assign a calculated value to the Result variable (make sure that the correct return type was defined in the declaration section, in this case Numeric):

Result = adiffHtCy - 0.5 * adiffLtCy + 0.25 * adiffCy;

Assign a value to a Boolean variable:

IsReady = largest >= 0 And limitMove <> 0;

Assign a text value to a Text variable, and append data from a numeric variable there:

DisplayedText = "You are visitor number " + VisitorNo;