9. Procedures
A Tcl procedure is a command that you define with a Tcl script. You can define new procedures at any time with the proc
command described in this chapter. Procedures make it easy for you to package solutions to problems so that they can be reused easily.
Tcl also provides special commands for dealing with variable scopes. Among other things, these commands allow you to pass arguments by reference instead of by value and to implement new Tcl control structures as procedures.
9.1 Commands Presented in This Chapter
The following Tcl commands relate to procedures and variable scoping:
• proc
name argList body
Defines a procedure whose name is name
, replacing any existing command by that name. argList
is a list with one element for ...
Get Tcl and the Tk Toolkit, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.