BRACKETS AND BRACES IN TCL
One of the big issues that newcomers feel is most difficult to get their head around in Tcl is when to use square brackets, when to use round brackets, and when to use curly braces.
THE RULE
SQUARE BRACKETS are used to define a block that's run BEFORE the rest of the command on the current line, and the result is substituted into the line.
CURLY BRACES are used to define a block that's deferred - in other words it may be run AFTER the rest of the command on the current line.
NOTES
ROUND BRACKETS are different - they're used either to indicate an array subscript, or to alter operator precedence in an expr command. They are not used in command precedence.
How do I help people remember this? I often equate the Square brackets with the very irritating Donkey in the Shrek Movies that always saying "Pick me ... pick me" ... an irritating but, as it turns out, very necessary and faithful friend.
This image is reproduced with permission of
hobby-box.co.uk
where painted horseshoes are offered for sale in support of
The Donkey Sanctuary, near Sidmouth, Devon
See also
Tcl training course
Please note that articles in this section of our
web site were current and correct to the best of our ability when published,
but by the nature of our business may go out of date quite quickly. The
quoting of a price, contract term or any other information in this area of
our website is NOT an offer to supply now on those terms - please check
back via
our main web site
Tcl/Tk - Tcl Fundamentals [3] - ()
[210] - ()
[328] - ()
[349] - ()
[362] - ()
[782] - ()
[1136] - ()
[1282] - ()
[1426] - ()
[1469] - ()
[2442] - ()
[3917] - ()
[4324] - ()
[4453] - ()
Tcl/Tk - A Review of Tcl and Tk Basics [1092] - ()
[1174] - ()
[1181] - ()
[1469] - ()
[4208] - ()
resource index - TclTk
Solutions centre home page
You'll find shorter technical items at
The Horse's Mouth and
delegate's questions answered at
the
Opentalk forum.
At Well House Consultants, we provide
training courses on
subjects such as Ruby, Lua, Perl, Python, Linux, C, C++,
Tcl/Tk, Tomcat, PHP and MySQL. We're asked (and answer)
many questions, and answers to those which are of general
interest are published in this area of our site.