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

why cannot run in the proc

Status
Not open for further replies.

jloh81

Programmer
Jun 15, 2010
16
US
hi,

I try to call 2 proc togather but the second proc seems cannot work like what it work without the first proc.

Below is the code:

proc comparevalue {} {
.....
}
proc writetocsv {} {
.....
}

comparevalue
writetocsv


Please advice.
Thanks
 
Hi

With that code and that description of the problem we can only guess.

My guess is, variable visibility is not clear for you. In which case, compare the following three code and their behavior :
Code:
[b]set[/b] foo bar
[b]proc[/b] comparevalue [teal]{}[/teal] [teal]{[/teal]
  [b]set[/b] foo NObar
[teal]}[/teal]
[b]proc[/b] writetocsv [teal]{}[/teal] [teal]{[/teal]
  [b]puts[/b] [navy]$foo[/navy]
[teal]}[/teal]
comparevalue
writetocsv
Code:
[b]set[/b] foo bar
[b]proc[/b] comparevalue [teal]{}[/teal] [teal]{[/teal]
  [b]set[/b] foo NObar
[teal]}[/teal]
[b]proc[/b] writetocsv [teal]{}[/teal] [teal]{[/teal]
[highlight]  [b]global[/b] foo[/highlight]
  [b]puts[/b] [navy]$foo[/navy]
[teal]}[/teal]
comparevalue
writetocsv
Code:
[b]set[/b] foo bar
[b]proc[/b] comparevalue [teal]{}[/teal] [teal]{[/teal]
[highlight]  [b]global[/b] foo[/highlight]
  [b]set[/b] foo NObar
[teal]}[/teal]
[b]proc[/b] writetocsv [teal]{}[/teal] [teal]{[/teal]
[highlight]  [b]global[/b] foo[/highlight]
  [b]puts[/b] [navy]$foo[/navy]
[teal]}[/teal]
comparevalue
writetocsv

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top