5.33.3.2 Procedures created with the proc command

You use the proc command to declare a procedure. You can then use the name of the procedure as a Tcl command. The following sample script consists of a single command named proc. The proc command takes three arguments:

  • The name of a procedure (myproc)
  • A list of argument names (arg1 arg2)
  • The body of the procedure, which is a Tcl script

proc myproc { arg1 arg2 } { # procedure body

}

myproc a b