21.1.7 Quotes and Braces

The distinction between braces ({ }) and quotes (" ") is significant when the list contains references to variables. When references are enclosed in quotes, they are substituted with values. However, when references are enclosed in braces, they are not substituted with values.

The following table lists an example code.

With Braces With Double Quotes
set b 2set b 2
set t { 1 $b 3 }set t " 1 $b 3 "
set s { [ expr $b + $b ] }set s " [ expr $b + $b ] "
puts stdout $tputs stdout $t
puts stdout $sputs stdout $s

The above example code will generate the following output:

1 $b 3 vs. 1 2 3
[ expr $b + $b ] 4