basic.end Statement/BASIC Program

basic.end

Command basic.end Statement/BASIC Program
Applicable release versions: AP, R83
Category BASIC Program (486)
Description indicates both the end of a series of statements executed conditionally from a "then" or "else" condition or the physical end of the program.

The "end" statement is used in two ways:

1) physical program end (optional)
.......statements.......
.....body of program....
.......statements.......
end

The trailing "end" statement is not required on Pick/BASIC source code, but is helpful for program readability. Any statements after the "end" statement (in this case) are not compiled.

2) Multi-line then/else statements must have terminating "end" statements:

if logical.expression then
statement
.
end
Syntax
Options
Example
10 *
input ans
if ans='n' then
print 'Please retype ':
goto 10
end

This example reprompts for "ans" if the previous "ans" is 
"n".

open 'md' to md else
print 'Cannot open file'
stop
end
crt 'File opened'

If the "md" file does not exist, a warning message is printed and 
program execution stops.  Notice that "stop" is the Pick/BASIC 
runtime directive which indicates the termination of runtime.  The 
"end" statement indicates the end of the multiple line 
"then" statement.  Without the "stop", program execution 
continues with the next statement after the "end" statement.
Purpose
Related basic.then
basic.then/else.construct
basic.stop
basic.abort