Square brackets execute a nested command. For example, if you want to pass the result of one command as the argument to another, you use this syntax. In this example, the nested command is clock seconds, which gives the current time in seconds.
set a 2
set b [expr
$a*16]
SETVAL tag1=[GETVAL tag2]
When a square bracket [
appears in a
command, Tcl treats everything between it and the matching end
bracket ]
as a nested command.
Tcl evaluates the nested command and substitutes its result into
the enclosing command in place of the bracketed text. In the above
example, b = 65536 .
For the example,
SETVAL tag1=[GETVAL tag2]
the value of tag1 is set equal to current value of tag2. Tags2 is
read, then passed to SETVAL ACTION command for tag1.
For the example,
set delta [expr "$time2 - $time1"]
the value of local variables time2 and time1 are evaluated as part of an expression.