Skip to content

while

Execute a command repeatedly while a condition is true.

Syntax

tcl
while test command

Parameters

  • test: Boolean expression evaluated with expr before each iteration
  • command: Script to execute while test is true

Examples

Basic countdown

Output

Reading until condition

Output

Using break for complex exit

Output

Fibonacci sequence

Output

See Also