Lesson 4
1. Set X "ABC"
Puts "A simple substitution: $x \ n"
A simple example
2. Set y [set X "Def"]
Puts "Remember that set returns the new value of the variable:x: $x Y: $y \ n"
When [] is used, the return value within [] is defined as the value of Y
3. Set Z {[Set X "This is a string within quotes within braces"]}
Puts "Note the curly braces: $z \ n"
This is the string in the quotation marks in parentheses
4. Set a "[set X {This is a string within braces within quotes}]"
Puts "See how the set is executed: $a"
Puts "\ $x is: $x \ n"
At this point the values for X and A are the same string
5.set B "\[set y {This is a string within braces within quotes}]"
Puts "Note the \ escapes the bracket:\n \ $b is: $b"
Puts "\ $y is: $y"
Special attention:!! \[] will not be assigned within [] a series of operations, directly intact as output to B
Tcl Script Learning Four: [], "", {} learning and nested use