-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Tcl/Tk 8.5 Programming Cookbook
In this chapter, we will cover:
Looping with if
Looping with for
Looping with foreach
Looping with while
Continuing a procedure
Breaking out of a procedure
Nested looping
Control constructs are the building blocks of an action. In this chapter, we will explore the creation of procedures, as well as managing the flow of events.
Prior to the creation of constructs the programmer's primary tool was the goto statement. While this allowed recursive handling of conditions and minimized impact on memory usage, it resulted in non-modular code and added substantially to the overhead of debugging and maintenance.
In Tcl, as in all programming languages, a control construct is a command that instructs the program to perform a certain action (or actions) based on a predefined condition. How many times the action (or actions) is/are performed is based on the specific construct used. For example, an if statement will perform the pre-defined...
Change the font size
Change margin width
Change background colour