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 ihttp://www.tcl.tk/man/tcl/tutorial/Tcl12.html
本文介绍Tcl编程语言的基础用法,包括打印语句、变量赋值、流程控制语句及简单函数定义。通过实例展示了不同类型的puts命令使用方法,以及如何创建简单的循环和自定义过程。
3157

被折叠的 条评论
为什么被折叠?



