Specifications

Chapter 3. Program Structure
47
3.1 Program Overview
3.1.1 Statement Blocks
A statement block is a significant set of statements (which is also called "program routine").
The following types of statement blocks are available in programming for the BHT:
Avoid jumping into or out of the midst of any of the above statement blocks using the
GOTO
statement; otherwise, it will result in an error. (Refer to Section 3.1.2.)
[ 1 ] Subroutines
A subroutine is a statement block called from the main routine or other subroutines by the
GOSUB statement.
Using the
RETURN statement passes control from the called subroutine back to the statement
immediately following the GOSUB statement in the original main routine or subroutine.
[ 2 ] Error-/Event-handling Routines
An error- or event-handling routine is a statement block to which program control passes when
an error trap or event (of keystroke) trap occurs during program execution, respectively.
The
RESUME statement passes control from the error-handling routine back to the desired
statement.
The
RETURN statement in the keyboard interrupt event-handling routine returns control to the
statement following the one that caused the interrupt.
Statement Blocks Description
Subroutine
A routine called by the
GOSUB statement.
Error-/event-handling routine An error-/event-handling routine to which
control is passed when an error trap or event
(of keystroke) trap occurs, respectively.
User-defined function A function defined by any of the following
statements:
DEF FN (in single-line form)
DEF FN...END DEF (in block form)
SUB...END SUB
FUNCTION
...END FUNCTION
Block-structured statement
FOR...NEXT
IF
...THEN...ELSE...END IF
SELECT
...CASE...END SELECT
WHILE
...WEND