tcl脚本学习三: “ ”和{} 的学习

lesson 3

example ①:

set Z "zhou li "
set Z_LABEL "is a boy "

puts "\n................. examples of differences between \" and \{"
puts "$Z_LABEL $Z"
puts {$Z_LABEL $Z}
// {}将会把括号里面的东西全部原封不动的输出

 

example ②:


puts "\n....... examples of differences in nesting \{ and \" "
puts "$Z_LABEL {$Z}"
puts {Who said, "What this country needs is a good $0.05 cigar!"?}
// 第二行可以看出将{$Z}化简即为$Z, 所以第二行结果自然可将$Z所对应的变量输出,而不是直接输出
//第三行是“ 和\的嵌套使用: 谁在外面谁就有最终的控制权

 

posted @ 2016-08-02 23:06  用不着为这点小事烦恼  阅读(1101)  评论(0编辑  收藏  举报