# 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
```

## See also

- [call statement](https://d3codex.com/pickbasic-flashbasic/call-statement/)
- [$chain directive](https://d3codex.com/pickbasic-flashbasic/dollar-chain-directive/)
- [common statement](https://d3codex.com/pickbasic-flashbasic/common-statement/)
- [cleardata statement](https://d3codex.com/pickbasic-flashbasic/cleardata-statement/)
- [execute statement (UNIX)](https://d3codex.com/pickbasic-flashbasic/execute-statement-unix/)
- [precision statement](https://d3codex.com/pickbasic-flashbasic/precision-statement/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)
- [subroutine statement](https://d3codex.com/pickbasic-flashbasic/subroutine-statement/)
- [tcl statement](https://d3codex.com/pickbasic-flashbasic/tcl-statement/)

---
Source: https://d3codex.com/pickbasic-flashbasic/enter-statement/ - part of the D3Codex reference.
