# loop command

The loop BASIC program performs any
TCL command a specific number of times, or continuously, until any
key is pressed on the keyboard.

**Synonyms:** loop-on

## Syntax

```
loop {loop.count} {\sleep.count\} tcl.commands
```

## Parameter(s)

| loop.count | Indicates the number of times to execute the command. If the loop count is omitted, the loop is infinite. To stop the loop, press any key on the keyboard. |
| --- | --- |
| sleep.count | Indicates the number of seconds for the process to sleep between each command execution. If the sleep count is not specified, the command repeats immediately. |

## Example(s)

Executes the ovf command three times, sleeping 10 seconds between each execution.

```
loop 3 \5\ ovf

ovf
overflow: 34860 reserve: 1024 blocks: 7 b-tree levels: 1 leaves: 1
ovf
overflow: 34924 reserve: 1024 blocks: 34 b-tree levels: 1 leaves: 1
ovf
overflow: 34909 reserve: 1024 blocks: 17 b-tree levels: 1 leaves: 1
```

## See also

- [Output processor overview](https://d3codex.com/output-processor/output-processor-overview/)

---
Source: https://d3codex.com/tcl/loop-command/ - part of the D3Codex reference.
