Chapter
51
Basic
Concepts
BASIC evaluates
5
to the
2.8
power
first,
then multiplies
X*X,
and finally adds the
2
values.
You can change the order of the hierarchy by adding parentheses
to an expression. BASIC always evaluates the expressions inside
the parentheses before evaluating the rest of the expression.
Look
at
this
expression:
X
*
(X
+
5Y2.8
BASIC evaluates the expression
(X
+
5)
first and raises that
value to the
2.8
power before performing the multiplication.
If an expression contains multiple parentheses, BASIC evaluates
the innermost parentheses first.
Functions
A function
is
a
built-in sequence of operations that BASIC per-
forms on data. BASIC always performs functions first when eval-
uating a statement.
Numeric functions, such as ABS,
SQR,
and COS, perform prede-
fined operations on numeric data.
String functions, such
as
MID$, VAL$, and LEN$, perform oper-
ations on string data.
Functions are described in Chapter
10.
56