enter statement

The enter statement transfers control to another cataloged FlashBASIC or BASIC program.

Syntax

enter cataloged.program.name
enter @var

Parameter(s)

cataloged.program.name Specifies the cataloged command to execute.
@var The @var form specifies the program variable where the command exists.

Description

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.

Note: The enter statement must not be used from a subroutine.

Example(s)

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