# inputtrap...goto statement

The inputtrap...goto statement, using
the *str.exp*, sets up an automatic computed goto based on the next input @ statement’s
data. The position of each character in the string expression corresponds
to the position of the statement label in the list. This acts as a
trap that causes a goto on all subsequent input @ statements and branches to a label in the current
program.

## Syntax

```
inputtrap str.exp goto statement.label{,statement.label{,...}}
```

## Parameter(s)

| str.exp | An expression evaluating to characters to be searched for in the input. |
| --- | --- |
| statement.label | statement label to be branched to. |

## Description

inputtrap must precede its associated input @ statement.
Only one inputtrap statement can be active at any
time.

If data is entered that does not correspond to the inputtrap *str.exp*, then no trap occurs
and execution continues with the statement after the input
@.

## Example(s)

```
inputtrap "abcd" goto 10,20,30,40
input @(5,5):x
stop
10 print "You entered a"
stop
20 print "You entered b"
stop
30 print "You entered c"
stop
40 print "You entered d"
stop
```

## See also

- [inputerr statement](https://d3codex.com/pickbasic-flashbasic/inputerr-statement/)
- [inputnull statement](https://d3codex.com/pickbasic-flashbasic/inputnull-statement/)
- [inputtrap...gosub statement](https://d3codex.com/pickbasic-flashbasic/inputtrap-gosub-statement/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)

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