Tandy 1000 Basic Reference Manual page 159

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chapter
10 I
BASIC Kevwords
ERROR
Statement
ERROR code
Simulates a specified error during program execution.
Code is an integer expression in the range 0 to 255 specifying
one of BASIC's error codes.
This statement is used mainly for testing a n ON
ERROR
GOTO
routine. When the computer encounters a n
ERROR
statement, it
proceeds as if the error corresponding to that code has occurred.
(Refer
t o
Chapter 12 for a listing of error codes and their
meanings.)
Example
ERROR 1
causes a "NEXT without FOR" error (Code 1) when BASIC
reaches this line.
Sample Program
1 1 0 ON ERROR GOTO 4 0 0
1 2 0 I N P U T "WHAT
I S YOUR B E T " ;
B
1 3 0 I F
B > 5 0 0 0
THEN ERROR 2 1 E L S E GOTO 4 2 0
4 0 0 I F ERR
=
2 1 THEN P R I N T "HOUSE L I M I T
I S
$ 5 0 0
0"
4 1 0 I F E R L
=
1 3 0 THEN RESUME 5 0 0
4 2 0 S
=
S+B
4 3 0 GOTO 1 2 0
5 0 0 P R I N T "THE
T O T A L AMOUNT OF YOUR B E T 1 S " ; S
5 1 0 END
This program receives and totals bets until one of them exceeds
the house limit.
157

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents