CLEARDATA Statement

Clears data that has been stored as stacked input by the DATA statement.

Syntax

CLEARDATA

Operation

When a CLEARDATA statement has been executed, subsequent INPUT statements will request input from the terminal.

CLEARDATA can be used to ensure that the stack is empty prior to requesting terminal input.

Example

CLEARDATA
DATA '1'
DATA '2'
DATA '3'
INPUT A; PRINT A
INPUT B; PRINT B
CLEARDATA
INPUT C; PRINT C

The first CLEARDATA statement ensures that the data stack is empty. Three data elements are then stacked and the first two are used to satisfy the first two INPUT statements. However, before the third INPUT statement can be satisfied by stacked data, the stack is cleared, so that input will be requested from the terminal.

See Also

DATA statement, INPUT statement.