如数字串123 转换成数字 123
123456 转换成数字123456
2 个解决方案
#1
% set a = 123
wrong # args: should be "set varName ?newValue?"
% set a 123
123
% set b 456
456
% puts $a+$b
123+456
% puts [expr $a+$b]
579
% puts [expr $a+$b]
579
%
wrong # args: should be "set varName ?newValue?"
% set a 123
123
% set b 456
456
% puts $a+$b
123+456
% puts [expr $a+$b]
579
% puts [expr $a+$b]
579
%
#2
tcl里面不分int 还是string型的
#1
% set a = 123
wrong # args: should be "set varName ?newValue?"
% set a 123
123
% set b 456
456
% puts $a+$b
123+456
% puts [expr $a+$b]
579
% puts [expr $a+$b]
579
%
wrong # args: should be "set varName ?newValue?"
% set a 123
123
% set b 456
456
% puts $a+$b
123+456
% puts [expr $a+$b]
579
% puts [expr $a+$b]
579
%
#2
tcl里面不分int 还是string型的