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!

[code] Hello all: I try to use co 1

Status
Not open for further replies.

stewang

Programmer
Aug 21, 2003
77
NZ
Code:
Hello all:
I try to use command with the " foreach varlist1 list1 ?varlist2 list2 ...? body ", but I failed for that, please tell me why. 

My coding as follow;

set p1 {1 2 3 4}
set p2 {3 4 5 6}
foreach p11 $p1 p22 $p2 {
  puts $p11
  puts $p22
}

it doesn't work


rgds
stewang
 
I tried your code and it worked fine. I got:
Code:
1
3
2
4
3
5
4
6
That is: the first item of the first list, the first item of the second list, the second item of the first list...
What is wrong for you?

ulis
 
You are right? I think I maybe not save them probably.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top