DarinT
DarinT

Reputation: 5

Please explain the expression in this Tcl if statement

I've not seen a Tcl if {expression} like the one below. I need help understanding $TVAR(h_flows,comm,current_stage)

Thanks!!

if {$TVAR(h_flows,comm,current_stage) == "300_start"} {  
   puts "...

Upvotes: 0

Views: 55

Answers (2)

Donal Fellows
Donal Fellows

Reputation: 137587

The $TVAR(h_flows,comm,current_stage) is just a read (because $) from the h_flows,comm,current_stage element of the TVAR array. Yes, the name of that element has commas in it, and some people use that to create compound keys, but the array itself (and Tcl) doesn't care.

Upvotes: 1

Shawn
Shawn

Reputation: 52409

It just tests if that particular array element's value is equal to the given string (And it really should be using eq, not ==, to force string comparison).

If you're not familiar with Tcl arrays, see this introduction in the Tcler's Wiki.

Upvotes: 2

Related Questions