tcl脚本学习二:特殊符号学习

lesson 2 :特殊符号学习 !


example ① :

set Z "zhou li "
set Z_LABEL "boy "

puts "$Z_LABEL $Z"
puts "$Z_LABEL \$Z"

// 可通过 \将特殊符号输出,和C语言一样

 


example ② :

1. puts "\nI have $100.00 bill"
//如果这样会报错 :提示100.00非法 ps: \n是换行
2.

set a 100.00

puts "I have $a bill" ;

//如果这样就不会报错


3.puts "Lincoln is not on the $$a bill" ;# This is OK
//如果在$前面再加一个$ ,将会把$输出

4.puts "Hamilton is not on the \$a bill" ;# This is not what you want
//这种会输出$a bill

5.puts "Ben Franklin is on the \$$a bill" ;# But, this is OK
//这种情况下可以

6.puts "\n................. examples of escape strings"
//学习 \n是换行

7.puts "Tab\tTab\tTab"
//学习 \t是留空格

8.puts "This string prints out \non two lines"
puts "This string comes out\
on a single line"
//若一行写不完,可通过这种方式拼接

 

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