Navigation: Language Reference > 2 - Program Source Code Format > Program Format >====== END (terminate a structure) ====== | |
END
END terminates a data declaration structure or a compound executable statement. It is functionally equivalent to a period (.).
By convention, the END statement is aligned in the same column as the beginning of the structure it terminates, and the code within the structure is indented for readability. END is usually used to terminate multi-line structures, while the period is used to terminate single-line statements. If multiple complex code structures are nested and they all terminate at the same place, multiple periods on one line are used instead of the END statements on multiple lines.
Example:
Customer FILE,DRIVER('Clarion') !Declare a file
RECORD !begin record declaration
Name STRING(20)
Number LONG
END !end record declaration
END !End file declaration
Archive FILE,DRIVER('Clarion') !Declare a file
RECORD !begin record declaration
Name STRING(20)
Number LONG
END
END !end both the record and file declarations
CODE
IF Number <;> SavNumber !Begin if structure
DO GetNumber
END !End if structure
IF SomeCondition THEN BREAK END !Terminate with END
CASE Action !Begin case structure
OF 1
DO AddRec
IF Number <;> SavNumber !Begin if structure
DO SomeRoutine
END !End if structure
OF 2
DO ChgRec
OF 3
DO DelRec
END !End case structure