48
[ 3 ] User-defined Functions
Before calling user-defined functions, it is necessary to define those functions with any of the
following statements. Generally, those statements should be placed before the main routine
starts.
DEF FN
(in single-line form)
DEF FN
...
END DEF
(in block form)
SUB
...
END SUB
FUNCTION
...
END FUNCTION
When using
SUB
and
FUNCTION
functions written in other files, it is necessary to declare
them with the
DECLARE
statement before calling them.
[ 4 ] Block-structured Statements
The statements listed below have the statement block structure and are useful for structured
programming.
FOR...NEXT
IF...THEN...ELSE...END IF
SELECT...CASE...END SELECT
WHILE...WEND
■
Nested Structure
Block-structured statements allow you to write nesting programs as shown below.
FOR i=1 TO 10
FOR j=2 TO 10 STEP 2
PRINT i, j, k
NEXT j
NEXT i
Nesting subroutines as shown below is also possible.
GOSUB aaa
.
.
.
aaa
PRINT "aaa"
GOSUB bbb
RETURN
bbb
PRINT "bbb"
RETURN
Summary of Contents for BHT-BASIC 100 SERIES
Page 1: ......
Page 161: ...153 Chapter 10 Sleep Function CONTENTS 10 1 Sleep Function 154...
Page 163: ...155 Chapter 11 Resume Function CONTENTS 11 1 Resume Function 156...
Page 173: ...165 Chapter 13 Backlight Function CONTENTS 13 1 Backlight Function 166...
Page 249: ...241 Example CLOSE IF kyIn Y THEN KILL Master Dat END IF Reference Statements CLFILE...