Sharp mz-800 Owner's Manual page 78

Hide thumbs Also See for mz-800:
Table of Contents

Advertisement

Example
10 IF C<1
THEN C=3
:ELSEC=C-—1
This statement assigns 3 to C if C is less than 1; otherwise, assigns C-1 to C.
10 IF C<
>D THEN
150 :ELSE END
This statement causes jump to line 150 if C is not equal to D; otherwise, ends pro-
gram execution.
10 IF AS="'ABC'' THEN A$ =AS + "'DEF"'
This statement assigns ''ABCDEF"' to AS if A$ contains "'ABC''; otherwise, the
program proceeds to the next line.
Note:
(Precautions on comparison of numeric values with BASIC 1Z-016)
Numeric values are represented internally with binary floating point representation;
since such values must be converted to other forms for processing or external dis-
play (such as in decimal format with the PRINT statement), a certain amount of
conversion error can occur.
For example, when an arithmetic expression is evaluated whose mathematical result
is an integer, an integer value may not be returned upon completion of the opera-
tion if Values other than integers are handled while calculations are being made.
Be aware of this and take it into consideration when evaluating relational expres-
sions using '*="'.
This need is illustrated by the sample program below, which returns FALSE after
testing for equality between 1 and 1/100* 100.
10 A=1/100* 100
20 IF A=1
THEN PRINT ''TRUE'':ELSE PRINT ''FALSE"'
30 PRINT "A=";A
40 END
RUN
FALSE
A=
1
The fact that both ''FALSE"' and ''A=1"' are displayed as the result of this pro-
gram shows that external representation of numbers may differ from the number's
internal representation in the computer.
6-21

Advertisement

Table of Contents
loading

Table of Contents