Introduction to the Tcl command language

tcl是基于字符串的语言。它允许:

1.变量和变量替换

2.数学表达式的求值

3.基本的控制结构(if,while,for,foreach)

4.程序

5.文件操作

incr a等价于a = a+1

每一句的结束可以换行,也可以用分号;

tcl基本的语法格式:

command $arg1 $arg2  ...

command是tcl的命令名称,也可以是用户定义的程序名称

$arg1 $arg2 为命令参数

支持命令的嵌套[] command [nested-command1] [nested-command2]

赋值语句 set a 1

注释用#: set a 5; #assign the value 5 to variable a

$符号表示提取数值,如puts $a

set a 1

set b a

set b $a

expr后加表达式会计算,如

>expr 2+3

5

原文地址:https://www.cnblogs.com/jiangkejie/p/5886641.html