next up previous
Next: Procedures Up: Tcl: A Generic Previous: Quoting

Control Structures

Control structures:
Example:

Raise base to the power of p, put result in r:
    set r 1
    while {$p > 0} {
        set r $r*$base 
        set p [expr $p-1]
    }
Commands:
    if        for       switch    break
    foreach   while     eval      continue



CS488/688: Introduction to Interactive Computer Graphics
University of Waterloo
Computer Graphics Lab

cs488@cgl.uwaterloo.ca