Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
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.


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.


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.

Donkey Week Horseshoe Sidmouth 2005

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

Related Material

Tcl/Tk - Tcl Fundamentals
  [4453] Tcl variable names - no real limits! - (2015-03-10)
  [4324] Learning to program - variables and constants - (2014-11-22)
  [3917] BODMAS - the order a computer evaluates arithmetic expressions - (2012-11-09)
  [2442] Variable storage - Perl, Tcl and Python compared - (2009-10-08)
  [1469] Curley brackets v double quotes - Tcl, Tk, Expect - (2007-12-12)
  [1426] Buffering up in Tcl - the empty coke can comparison - (2007-11-10)
  [1282] Stringing together Tcl scripts - (2007-07-29)
  [1136] Buffering output - why it is done and issues raised in Tcl, Perl, Python and PHP - (2007-04-06)
  [782] Converting between Hex and Decimal in Tcl - (2006-06-28)
  [362] The ireallyreallywanna operator - (2005-06-28)
  [349] Comments in Tcl - (2005-06-16)
  [328] Making programs easy for any user to start - (2005-05-29)
  [210] Joining lists in Tcl. Indirect variables in Tcl. - (2005-02-12)
  [3] Looking for a donkey - (2004-08-05)

Tcl/Tk - A Review of Tcl and Tk Basics
  [4208] Tcl + Tk (Wish) - an introduction and revision example - (2013-11-15)
  [1469] Curley brackets v double quotes - Tcl, Tk, Expect - (2007-12-12)
  [1181] Good Programming practise - where to initialise variables - (2007-05-09)
  [1174] Installing Tcl and Expect on Solaris 10 - a checklist - (2007-05-02)
  [1092] Tcl training - often for a larger group - (2007-02-24)

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.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2019: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/solutions/tcl-brac ... n-tcl.html • PAGE BUILT: Wed Mar 28 07:47:11 2012 • BUILD SYSTEM: wizard