Reputation: 5959
set windowSize 0
for {set i 0} {$i < 14} {incr i} {
set $windowSize [expr $windowSize + [$tcp($i) set cwnd_]]
}
puts "$windowSize"
This prints out zero, when the values being added are non zero. How to do this without a temp var? Holla if you love TCL. ...dead silence.
Upvotes: 1
Views: 1363
Reputation: 4866
set $windowSize
substitutes the value of $windowSize
before running the command.
You want set windowSize [expr ...]
, or even simpler:
incr windowSize [$tcp($i) set cwnd_]
Upvotes: 7