ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 阶乘计算脚本 ```tcl #!/usr/bin/wish proc fac {val} { set rt 1 while {$val>0} { set rt [expr $rt*$val] incr val -1 } return $rt } entry .value -width 6 -relief sunken -textvariable value label .description -text "factorial is" label .result -textvariable result button .calculate -text "Calculate" -command { set result [fac $value] } bind .value <Return> { .calculate flash .calculate invoke } grid .value .description .result -padx 1m -pady 1m grid .calculate - - -padx 1m -pady 1m ```