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, inputnull Statement, inputtrap...gosub Statement, Statements and Functions