tcl的helloworld

编程技术  /  houtizong 发布于 3年前   111
http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html

puts "Hello, World - In quotes"    ;# This is a comment after the command.# This is a comment at beginning of a lineputs {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 HelloWorldputs {Bad comment syntax example}   # *Error* - there is no semicolon!

输出:
Hello, World - In quotesHello, World - In BracesThis is line 1this is line 2Hello, World; - With  a semicolon inside the quotesHelloWorldwrong # 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: 5The for command has been replaced by a putsThe arguments were: set i 1$i < 10incr i


http://www.tcl.tk/man/tcl/tutorial/Tcl12.html

请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!

留言需要登陆哦

技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成

网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];

      订阅博客周刊 去订阅

文章归档

文章标签

友情链接

Auther ·HouTiZong
侯体宗的博客
© 2020 zongscan.com
版权所有ICP证 : 粤ICP备20027696号
PHP交流群 也可以扫右边的二维码
侯体宗的博客