Tcl Braces, Quotes and Brackets
Braces, quotes, and square brackets control when variables and commands are processed. They are also used to group parameters.
set var1 HyperWorks uses Tcl and Tk;
rong # args: should be "set varName ?newValue?"
set var1 "HyperWorks uses Tcl and Tk";
set var1 {HyperWorks uses Tcl and Tk};
set var1 HyperWorks;
puts "$var1 uses Tcl and Tk";
HyperWorks uses Tcl and Tk
set var1 HyperWorks;
puts "$ HyperWorks uses "Tcl and Tk"";
extra characters after close-quote
set var1 HyperWorks;
puts {$var1 uses Tcl and Tk};
$var1 uses Tcl and Tk
Braces are very handy for program control. For example, you define a Tcl/Tk button that calls the command puts $var1 to return the most recent value of var1 when the button is pressed. The parameter for the button command will be {puts $var1} because you don’t want Tcl to evaluate $var1 when the button is defined, but instead when the button is pressed.
set var1 HyperWorks;
set var2 [set var1];
puts $var2;
HyperWorks