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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning multiple values from the proc

Status
Not open for further replies.

kurdulla

Technical User
Aug 23, 2012
1
PL
Hello,

Im beginer in TCL, and I have a problem about returning a several values from the proc. How to do if I have a proc which is executed in another proc in the loop. Simple example is below. And let say that I need every returned value from the second proc.

proc first {arg1 arg2} {
set sum [expr {$arg1+$arg2}]
return $sum
}

proc second{}{
for {set i 0} {$i < 100} {incr i} {
for {set j 0} {$j <100} {incr j} {
set result [first $i $j]
return $result
}
}
}

I found in this topic:

that i should do it by the list, but if I have a lot of increments in the loop then can I construct a big list? Please help me, or give me some information where I can looking for.

The best regards:)
kurdulla
 
You can make the list as big as you like (use "lappend").

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top