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!

How to pass a variable value in a list?

Status
Not open for further replies.

LilTCLer

Programmer
Nov 27, 2007
37
US
This should be simple, but I'm having brain freeze.

Basically

set passFailList [ list ]
set test 1
lappend passFailList { $test Pass "" }
puts $passFailList

What I want to see is passFailList = { 1 Pass "" }

however, what I am getting is passFailList = { $test Pass "" }

When I'm appending the list, the parameter $test is not getting evaluated. What do I need to use to accomplish this?

TIA
 
I don't think that will work for what I want to do. Essentially, I am trying to create a list of lists. Eventually, the list will look like this:

passFailList = { {1 Pass "Comment"} {2 Pass "Comment"} {3 Pass "Comment"} }

This way, lindex $passFailList 0 = 1 Pass "Comment"

By doing it your way, the list is getting three separate elements - not one

Hopefully I'm explaining this correctly.
 
Thanks - that does it - like I said - Brain Freeze, I should've figured that out, but for some reason...

thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top