set value 120
puts [format %c $value]
set fmt1 "Today, %d shares in %s were bought at $%.2f each"
puts [format $fmt1 123 "Global BigCorp" 19.37]
set fmt2 "Bought %2/$s equity (/$%3/$.2f x %1/$d) today"
puts [format $fmt2 123 "Global BigCorp" 19.37]
# Set up the column widths
set w1 5
set w2 10
# Make a nice header (with separator) for the table first
set sep +-[string repeat - $w1]-+-[string repeat - $w2]-+
puts $sep
puts [format "| %-*s | %-*s |" $w1 "Index" $w2 "Power"]
puts $sep
# Print the contents of the table
set p 1
for {set i 0} {$i<=20} {incr i} {
puts [format "| %*d | %*ld |" $w1 $i $w2 $p]
set p [expr {wide($p) * 3}]
}
# Finish off by printing the separator again
puts $sep