Hitachi

JP1 Version 12 JP1/IT Desktop Management 2 Distribution Function Administration Guide


18.4.1 Assignment

The assignment operation in the AIT language assigns the value of the right operand to the left operand. In assignment, you cannot use any constant as the left operand.

Organization of this subsection

(1) Format

Assignment statement
assignment_expression END_STMT
Assignment expression
identifier assign_operand expression

(2) Description

In assignment, the value of the right operand is stored in the left operand. The left operand must neither be a function nor be a constant.

If the data type of the right operand differs from that of the left operand, type conversion is performed when possible. This type conversion depends on the specified operator, and the type of operator or operand.

The following table lists the results of type conversion in the AIT language. Warning messages and errors for data conversion are displayed upon syntax checks.

Left operand

Right operand

Result

Description

integer

integer

integer

The value of one integer-type variable is assigned to the other integer-type variable.

integer

float

integer

The truncated value is assigned to the integer-type variable. A warning message is displayed because the data may become inaccurate.

integer

bool

integer

The value true is assigned to the integer-type variable as 1. The value false is assigned to the integer-type variable as 0.

integer

string

Error

Since the string type cannot be converted to the integer type, an error message is displayed.

float

integer

float

The value of the integer-type variable is assigned to the float-type variable.

float

float

float

The value of one float-type variable is assigned to the other float-type variable.

float

bool

float

The value true is assigned to the float-type variable as 1. The value false is assigned to the float-type variable as 0.

float

string

Error

Since the string type cannot be converted to the float type, an error message is displayed.

bool

integer

bool

A non-0 value is assigned to the bool-type variable as true. 0 is assigned to the bool-type variable as false. Since the original data is lost, a warning message is displayed.

bool

float

bool

bool

bool

bool

The value of one bool-type variable is assigned to the other bool-type variable.

bool

string

Error

Since the string type cannot be converted to the bool type, an error message is displayed.

string

integer

Error

Since the integer type cannot be converted to the string type, an error message is displayed.

string

float

Error

Since the float type cannot be converted to the string type, an error message is displayed.

string

bool

Error

Since the bool type cannot be converted to the string type, an error message is displayed.

string

string

string

The value of one string-type variable is assigned to the other string-type variable

The AIT language supports multi-assignment. The multi-assignment here means assignment of a value to two variables.

(3) Example of coding

MAIN
    {
        a = 10;         // Value 10 is assigned to a.
        a = b = 20;     // Multi-assignment is coded.
                        // Value 20 is assigned to variable b,
                        // then to variable a.
    }