Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

procedure calls 1

Status
Not open for further replies.

Thodd

Technical User
Oct 21, 2006
27
BE
Hi,

I'm trying to call serveral procedures in a for-loop, but each cycle of the loop calls another procedure (named procedure0, procedure1,...), like this:

for {set x 0} {$x < 10} {incr x} {
puts "loopcount [expr $x + 1]"
$ns at $x "procedureX"
}

Does someone know how I can do this?
thx
 
You're right feherke.
Tcl also permits array of procedures:
Code:
proc procedure(1) {} { puts "one" }
proc procedure(2) {} { puts "two" }
proc procedure(3) {} { puts "three" }

for {set i 1} {$i<=3} {incr i} { procedure($i) }
No more eval.

ulis
 
Is Ulis's solution a lot faster, instead of using "eval"?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top