Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Tcl 中有以下脚本:
set val(a) 10 set val(b) 10 set val(n) expr{$val(a) * $val(b)}
如何打印变量n的值?
puts $val(n)
给了 expr{10*10} ,我需要看到 100....
expr{10*10}
为了评估表达式并返回结果,您必须将eval命令放在方括号内,而不是尝试像函数一样调用它:
eval
set val(n) [expr {$val(a) * $val(b)}] puts $val(n)