# cleardata statement

The cleardata statement clears the data
stack.

## Syntax

```
cleardata
```

## Example(s)

The following program is invoked
from a macro. A list of filenames and record IDs is passed to it from
the macro with DATA statements.

```
5 *
input filename
if filename = "end" then stop
open filename to file else
 print "can’t open file ":filename
 print "please enter new filename "
 cleardata
 goto 5
end
```

## See also

- [$chain directive](https://d3codex.com/pickbasic-flashbasic/dollar-chain-directive/)
- [enter statement](https://d3codex.com/pickbasic-flashbasic/enter-statement/)
- [execute statement (UNIX)](https://d3codex.com/pickbasic-flashbasic/execute-statement-unix/)
- [inputclear statement](https://d3codex.com/pickbasic-flashbasic/inputclear-statement/)
- [type-ahead command](https://d3codex.com/tcl/type-ahead-command/)

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