lesson 7 : if的学习
1. set x 1;
if {$x == 2} {puts "$x is 2"} else {puts "$x is not 2"}
if {$x != 1} {
puts "$x is != 1"
} else {
puts "$x is 1"
}
//if的基本用法
2. if $x==1 {puts "GOT 1"}
//可以if里面的判断语句可以不加括号
3. set y x;
if "$$y != 1" {
puts "$$y is != 1"
} else {
puts "$$y is 1"
}
//在if里面$x替换成1 而在puts里面解释一次,以字符串形式进行
原文:http://www.cnblogs.com/gold-life/p/5731129.html