Updated 2012-09-17 15:07:14 by LkpPo

In Tcl, a procedure is a Tcl command that has been created by the proc command.

RS: A procedure is a script with an argument list (in other words, a lambda) bound to a command name, by which it can be called. The arguments make the initial set of local variables, to which you might add others. All of these will be removed on leaving the procedure. See global or variable or upvar on how to "import" variables from upper scopes. In Tcl, procedures are defined with the proc command, for example:
 proc myproc {arg1 arg2} {
    # do something here, e.g.
    puts arg1:$arg1,arg2:$arg2
 }

Each procedure returns a result - if not explicitly by return, then it's the result of the last command. So in Tcl, every procedure is also a function.