I have the following script in Tcl:
set val(a) 10
set val(b) 10
set val(n) expr{$val(a) * $val(b)}
How to print the value of the variable n?
puts $val(n)
gives expr{10*10}
and i need to see 100....
In order to evaluate an expression and return the results, you must put the eval
command inside square brackets, rather than try to call it like a function:
set val(n) [expr {$val(a) * $val(b)}]
puts $val(n)