Introduction
When I first started using Tcl, everything I read or researched stressed the mantra "Everything is a string". Coming from a hard-typed coding environment, I was used to declaring variable types and in Tcl this was not needed. A set
command could—and still does—create the variable and assigns the type on the fly. For example, set variable "7
" and set variable 7
will both create a variable containing 7
. However, with Tcl, you can still print the variable containing a numeric 7
and add 1
to the variable containing a string representation of 7
.
It still holds true today that everything in Tcl is a string. When we explore the Tk Toolkit and widget creation, you will rapidly see that widgets themselves have a set of string values that determine their appearance and/or behavior.
As a pre-requisite for the recipes in this chapter, launch the Tcl shell as appropriate for your operating system. You can access Tcl from the command line to execute the commands.
As with everything else we...