Tcl and OTcl Tutorial For NS2 Procedures Procedures Procedures are an essential component of Tcl and can be used to make programming ns simpler. As in any functional programming language, procedures can be used for repetitive tasks, or simply to logically break down the tasks in the program. Procedures are defined in Tcl as follows: proc proc1 {} { puts "in procedure proc1" } This defines a procedure that takes no parameters and prints out "in procedure proc1". To call this procedure proc1 can be used. A procedure with parameters can be defined as follows: proc proc2 {parameter1} { puts "the value of parameter1 is $parameter1" } This procedure can be invoked as follows: proc2 10 A procedure that returns a value can be defined as follows: proc proc3 {min max} { set randomvar [rand $min $max] return $randomvar } This procedure generates a random variable and returns it to the calling function. This can be invoked ...