Caché MultiValue Basic Reference
END
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

Terminates a block of code or a program.
Synopsis
END
Arguments
None.
Description
The END statement has three uses:
Clause Terminator
When used as a clause terminator, the END keyword terminates execution of a block of code.
END is used as part of an IF...THEN statement, where it terminates execution of the block of code for the current clause of the IF...THEN statement.
END is used as part of a multiline LOCKED clause, ON ERROR clause, THEN clause, or ELSE clause, where it terminates execution of the block of code.
Block code clauses have specific line break requirements:
The following are valid syntactic forms:
command args
THEN
statement1
statement2
END
ELSE
statement1
statement2
END
command args THEN
statement1
statement2 END
ELSE
statement1
statement2 END
command args THEN
statement1
statement2
END ELSE
statement1
statement2
END
Statement Terminator
The END keyword is used with another keyword in a few statements to indicate the end of the code encompassed by that statement. These uses are:
Routine Terminator
When used outside of a block structure clause END terminates routine or program execution. Commands following an END statement are not executed. If additional lines of code appear after the END statement, Caché (and all emulation modes), by default, generates an error: “Unexpected line outside of program”. You can set $OPTIONS IGNORE.EXTRA.LINES to ignore lines that appear after the END statement, rather than issuing an error message.
See Also