Expressions; Arithmetic Expressions And Operators - IBM 5100 Basic Reference Manual

Hide thumbs Also See for 5100:
Table of Contents

Advertisement

(
(
(
(
(
(
EXPRESSIONS
An expression in BASIC is any representation of an arithmetic or character value.
Constants, variables, arrays, array element references, and function references are all
considered expressions. Expressions can also be formed by combining any of these
value representations with symbols called operators.
An operator specifies either the relationship between data items, an arithmetic oper-
ation to be performed on them, or whether they are positive or negative. For
example, the symbols
>,
*,
and + are operators specifying greater than, multiplication,
and addition (or positive value), respectively.
A special class of expressions, called relational expressions, is used with the I F state-
ment to test the truth of specified relationships between two values.
Expressions referring to entire arrays, rather than individual array elements, are
called array expressions. An expression that does not contain a reference to an
entire array is called a scalar expression.
Arithmetic Expressions and Operators
An arithmetic expression can be an arithmetic variable, array element, constant, or
function reference; or it can be a series of the preceding items separated by operators
and parentheses. Some examples of arithmetic expressions are:
A1
X3/ (-6)
X+Y+Z
SIN(R)
-6.4
-(X-Xt2/ 2+ X)
The value of an arithmetic expression is obtained by performing the implied oper-
ations on the specified data items.
The five arithmetic operators are:
Symbol
Meaning
tor
**
Exponentiation
*
Multiplication
/
Division
+
Addition
Subtraction
Note that the system stores
* *
as t.
51

Advertisement

Table of Contents
loading

Table of Contents