StructuredBasic

Guidelines for writing structured programs with unstructured BASIC language systems.

These guidelines assume support for only the following flow-control statements:

DEF
GOSUB/RETURN
GOTO
ON GOTO
IF THEN
FOR TO/NEXT

(DEF, GOSUB/RETURN, and FOR TO/NEXT statements can be used straightforwardly to define functions, subroutines, and incremental loops. Their use for such is encouraged.)

Conditional execution (single branch)

LineStatementPseudocodeRemarks
100IF condition THEN 150if not conditioncondition expresses the condition in which statement ...
110statement    statementwill be skipped, and is therefore opposite in sense to
...    ...the condition of an ordinary if structure.
150REM END IFend if

Conditional execution (two-branch)

100IF condition THEN 150if not conditioncondition expresses the condition in which statement-1 ...
110statement-1    statement-1will be skipped and statement-2 executed, and is therefore
...    ...opposite in sense to the condition of an ordinary if
120GOTO 200structure.
150REM ELSEelse
160statement-2    statement-2
...    ...
200REM END IFend if

Repetition (test before loop entry)

100IF condition THEN 150
110statement
...
120GOTO 100
150REM END WHILE

Repetition (test at loop end)

100REM BEGIN UNTIL
110statement
...
120IF condition THEN 100
150REM END UNTIL