end statement

The end statement indicates both the end of a series of statements executed conditionally from a then or else condition or the physical end of the program.

Syntax

end

Description

The end statement is used in two ways:

  • Physical program end (optional):

    ....... statements.......
    ..... body of program....
    ....... statements.......
    end
    

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

  • Multiline then/else statements must have terminating end statements:

    if logical.expthen
       statement
       .
       end
    

Example(s)

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

10 *
input ans
if ans=’n’ then
   print ’Please retype ’:
   goto 10
end

If the md file does not exist, a warning message is printed and program execution stops. Notice that stop is the FlashBASIC or BASIC run-time directive that indicates the termination of run time. 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.

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