TAL Programmer's Guide
5 Using Expressions
096254 Tandem Computers Incorporated 5–1
This section describes how you use arithmetic and conditional expressions. It gives
information about operands (identifiers, data types, variables, constants) and about
arithmetic and conditional operators and their effect on operands.
For information about assignment, CASE, IF, and group comparison expressions, see
Section 13, “Using Special Expressions.”
About Expressions An expression is a sequence of operands and operators that, when evaluated,
produces a single value. Operands in an expression include variables, constants, and
function identifiers. Operators in an expression perform arithmetic or conditional
operations on the operands.
Expressions, for example, can appear in:
LITERAL declarations
Variable initializations and assignments
Array and structure bounds
Indexes to variables
Conditional program execution
Parameters to procedures or subprocedures
Complexity An expression can be:
A single operand, such as 5
A unary plus or minus operator applied to a single operand, such as –5
A binary operator applied to two operands, such as 5
*
8
A complex sequence, such as:
(((alpha + beta) / chi) * (delta — 145.9)) / zeta
Functionality The compiler at times requires arithmetic or conditional expressions. Where indicated,
specify one of the following kinds of expressions:
Expression Description Examples
Arithmetic
expression
An expression that computes a single numeric value
and that consists of operands and arithmetic
operators.
398 + num / 84
10 LOR 12
Constant
expression
An arithmetic expression that contains only
constants, LITERALs, and DEFINEs as operands.
398 + 46 / 84
Conditional
expression
An expression that establishes the relationship
between values and that results in a true or false
value. It consists of relational or Boolean conditions
and conditional operators.
Relational: a < c
Boolean: a OR b