http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html
输出:
--------------------------
------又发现搞笑代码了--魔幻语言就是让人容易误解--
输出:
http://www.tcl.tk/man/tcl/tutorial/Tcl12.html
puts "Hello, World - In quotes" ;# This is a comment after the command.
# This is a comment at beginning of a line
puts {Hello, World - In Braces}
puts "This is line 1"; puts "this is line 2"
puts "Hello, World; - With a semicolon inside the quotes"
# Words don't need to be quoted unless they contain white space:
puts HelloWorld
puts {Bad comment syntax example} # *Error* - there is no semicolon!
输出:
Hello, World - In quotes
Hello, World - In Braces
This is line 1
this is line 2
Hello, World; - With a semicolon inside the quotes
HelloWorld
wrong # args: should be "puts ?-nonewline? ?channelId? string"
while executing
"puts {Bad comment syntax example} # *Error* - there is no semicolon!"
(file "helloworld.tcl" line 10)
--------------------------
set x 1
# This is a normal way to write a Tcl while loop.
while {$x < 5} {
puts "x is $x"
set x [expr {$x + 1}]
}
for {set i 0} {$i < 10} {incr i} {
puts "I inside first loop: $i"
}
------又发现搞笑代码了--魔幻语言就是让人容易误解--
proc sum {arg1 arg2} {
set x [expr {$arg1 + $arg2}];
return $x
}
puts " The sum of 2 + 3 is: [sum 2 3]\n\n"
proc for {a b c} {
puts "The for command has been replaced by a puts";
puts "The arguments were: $a\n$b\n$c\n"
}
for {set i 1} {$i < 10} {incr i}
输出:
The sum of 2 + 3 is: 5
The for command has been replaced by a puts
The arguments were: set i 1
$i < 10
incr i
http://www.tcl.tk/man/tcl/tutorial/Tcl12.html