There are four kinds of assignment statements:
v = e
where:
Execution of an arithmetic assignment statement causes the evaluation of the expression e by the rules in Section 6, conversion of e to the type of v, and definition and assignment of v with the resulting value, as established by the rules in Table 4.
_______________________________ | | | | Type of v | Value | | | Assigned | |__________________|__________| | | | | Integer | INT(e) | |__________________|__________| | | | | Real | REAL(e) | |__________________|__________| | | | | Double precision | DBLE(e) | |__________________|__________| | | | | Complex | CMPLX(e) | |__________________|__________|
The functions in the "Value Assigned" column of Table 4 are generic functions described in Table 5 (15.10).
v = e
where:
Execution of a logical assignment statement causes the evaluation of the logical expression e and the assignment and definition of v with the value of e. Note that e must have a value of either true or false.
ASSIGN s TO i
where:
Execution of an ASSIGN statement causes the statement label s to be assigned to the integer variable i. The statement label must be the label of a statement that appears in the same program unit as the ASSIGN statement. The statement label must be the label of an executable statement or a FORMAT statement.
Execution of a statement label assignment statement is the only way that a variable may be defined with a statement label value.
A variable must be defined with a statement label value when referenced in an assigned GO TO statement (11.3) or as a format identifier (12.4) in an input/output statement. While defined with a statement label value, the variable must not be referenced in any other way.
An integer variable defined with a statement label value may be redefined with the same or a different statement label value or an integer value.
v = e
where:
Execution of a character assignment statement causes the evaluation of the expression e and the assignment and definition of v with the value of e. None of the character positions being defined in v may be referenced in e. v and e may have different lengths. If the length of v is greater than the length of e, the effect is as though e were extended to the right with blank characters until it is the same length as v and then assigned. If the length of v is less than the length of e, the effect is as though e were truncated from the right until it is the same length as v and then assigned.
Only as much of the value of e must be defined as is needed to define v. In the example:
CHARACTER A*2,B*4 A=B
the assignment A=B requires that the substring B(1:2) be defined. It does not require that the substring B(3:4) be defined.
If v is a substring, e is assigned only to the substring. The definition status of substrings not specified by v is unchanged.