The enter statement transfers control to another cataloged FlashBASIC or BASIC program.
enter cataloged.program.name enter @var
cataloged.program.name | Specifies the cataloged command to execute. |
@var | The @var form specifies the program variable where the command exists. |
The program that is executed using the enter statement must be a cataloged program in the current master dictionary, and cannot be a subroutine. The program executing the enter statement need not be cataloged.
All variables passed between programs must be declared by the common statement in all program segments that are to be entered. All other variables are initialized upon entering the program. The common area grows or shrinks if the size is different between programs.
Control does not return to the original program. In this way, enter is similar to chain except that enter must be used to activate another FlashBASIC or BASIC program and nothing else.
The @ indicates that the program name is stored in the specified program variable. Without the @, the variable name is taken literally.
In the below example, a 5 is output.
program first.prog common x,y,z x = 5 enter second.prog program second.prog common x,y,z print x stop
In the example below, the program name is stored in a variable.
program first.prog common x,y,z x = 5 pgmname = "second.prog" enter @pgmname