永发信息网

TCL脚本语言:过程调用中用命令行传递参数如何实现

答案:2  悬赏:10  手机版
解决时间 2021-03-08 02:28
  • 提问者网友:抽煙菂渘情少年
  • 2021-03-07 11:07
比如有这样一个子程序
proc total {args}{
set total 0
foreach i $args{
incr total $i
}
return $total
}
如何来写调用语句来完成从命令行传递参数
最佳答案
  • 五星知识达人网友:第四晚心情
  • 2021-03-07 11:58
All Tcl scripts have access to three predefined variables.
$argc - number items of arguments passed to a script.
$argv - list of the arguments.
$argv0 - name of the script.
全部回答
  • 1楼网友:未来江山和你
  • 2021-03-07 12:32
你好! 用“args“关键字表示支持可变参数。 total [list 1 2 3] 如果对你有帮助,望采纳。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯