Specifications

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