
Characters within braces are passed to a command exactly as written. 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. Here we will see an example of “info exists”.Ĭurly braces in TCL group words together to become arguments. There are various “info” command in TCL like “info exists”, “info functions”, “info global”, and so on. The “info exists” command returns 1 if varName exists as a variable (or an array element) in the current context, otherwise returns 0. The unset command is used to destroy a variable. The “set” command is used to create and read variables as shown above.

So we get the value of variable ‘a’ as 10. To obtain the value of variable have to use “$” symbol like To create variables in TCL, you need to use “set” command Look at some example for case sensitive variable. It means hello, Hello, HELLO all are different in TCL. Variables are created by “set command” and all variable names are case sensitive. In other words, a variable is a reference to a computer memory, where the value is stored. TCL VariableĪ variable is an identifier which holds a value. All characters after the “#” are ignored by tclsh shell command. NOTE: –To comment any string in TCL “#” is used. In the example below, you can see special character ” “, remains after the backslash. Any character immediately following the backslash will stand without substitution. In Tcl, the backslash is used for escaping special characters as well as for spreading long commands across multiple lines. puts $a : It will print the value of ‘a’ to the console.puts a : It will print string “a” but not the value of ‘a’ to the console.

Here we create a variable called “a” and set value “10” to it. TCL performs variable substitution with the help of $ sign. ”expr” used for performing the arithmetic calculation. Here the command between the square brackets is evaluated first. Square brackets are used for command substitution. There are three kinds of substitutions in TCL
#ACTIVETCL TUTORIAL UPDATE#
We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. The user of this e-book is prohibited to reuse, retain, copy, distribute, or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. You just need to have a basic understanding of working with a simple text editor and command line.ĭisclaimer & Copyright Copyright 2015 by Tutorials Point (I) Pvt. This tutorial is self-contained and you will be able to learn various concepts of Tcl/Tk even if you are a beginner. Prerequisites Before proceeding with this tutorial, it is advisable for you to understand the basic concepts of computer programming. Therefore, we cover all those topics that are required for a beginner and an advanced user. This tutorial covers various topics ranging from the basics of the Tcl/ Tk to its scope in various applications.Īudience This tutorial is designed for all those individuals who are looking for a starting point of learning Tcl/ Tk. On the other hand, Tk is a cross platform widget toolkit used for building GUI in many languages. It is a scripting language that aims at providing the ability for applications to communicate with each other. About the Tutorial Tcl is a general purpose multi-paradigm system programming language.
