码迷,mamicode.com
首页 > 其他好文 > 详细

tcl脚本学习四: [] ,“” ,{} 的学习以及嵌套使用

时间:2016-08-02 23:49:40      阅读:431      评论:0      收藏:0      [点我收藏+]

标签:

lesson 4

 

1. set x "abc"
puts "A simple substitution: $x\n"
//简单的例子

2. set y [set x "def"]
puts "Remember that set returns the new value of the variable: X: $x Y: $y\n"
//当使用[]的时候,会将 []内的返回值作为y所定义的值

3. set z {[set x "This is a string within quotes within braces"]}
puts "Note the curly braces: $z\n"
//这是括号中引号中的字符串

4. set a "[set x {This is a string within braces within quotes}]"
puts "See how the set is executed: $a"
puts "\$x is: $x\n"
//此时x和a的值均为那个字符串

5.set b "\[set y {This is a string within braces within quotes}]"
puts "Note the \\ escapes the bracket:\n \$b is: $b"
puts "\$y is: $y"
//特别注意:!! \[]将不对[]内进行赋值等一系列操作,直接原封不动作为输出给b

tcl脚本学习四: [] ,“” ,{} 的学习以及嵌套使用

标签:

原文地址:http://www.cnblogs.com/gold-life/p/5731117.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!