HP Fortran Programmer's Reference (September 2007)

Expressions and assignment
Expressions
Chapter 4 85
Expressions
An expression is the specification of data and, possibly, a set of operations that enable the
computer to evaluate the expression and produce a value. Because an expression results in a
value, it has a type, kind, and shape. If an expression is of the character type, it also has a
length parameter.
The general form of an expression is:
[
operand1
]
operator operand2
operand1
,
operand2
are data objects or expressions that evaluate to data. They may be
array-valued or scalar-valued.
operator
is either an intrinsic or defined operator. If
operator
is unary,
operand1
must not be specified.
The following sections describe operands, operators, and expressions in more detail.
Operands
An operand may be any of the following:
A constant or a variable, such as 1.0, 'ab', or a
An array element or an array section, such as a(1,3) or a(1,2:3)
A character substring or a structure component, such as ch(1:3) or employee%name
An array constructor, such as (/1.0,2.0/)
A structure constructor, such as employee(8, "Wilson", 123876)
A function reference, such as SQRT(x)
An expression in parentheses, such as (b + SIN(y)**2)
Any variable or function reference used as an operand in an expression must have been
previously defined. Likewise, any pointer must have been previously associated with a target.
If an operand has the POINTER attribute, the target associated with it is the operand.
When an operand is a whole array reference, the complete array is referenced. An
assumed-size array variable cannot be an operand. An array section of an assumed-size array
can be an operand if the extent of the last dimension of the section is defined by the use of a