`
haoningabc
  • 浏览: 1448559 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

tcl的helloworld

阅读更多
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 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
分享到:
评论

相关推荐

    tcl快速入门.pdf

    Hello, World! Tk 样式 34 Tk 演示 36 Tk 小部件的分类取样器 36 Tk 命令,第一部分 38 Tk 命令,第二部分 39 真的(小)Tk 应用程序 39 样本 Tk 应用程序 41 样本 Tk 应用程序对话框 41 开始认识 Expect 43 Expect ...

    TCL、TK学习交流文档

    Tcl介绍 “Hello World” 程序及扩展 变量 数据类型 特殊字符 数据结构 控制结构 程序结构 语法要点 对数据库操作实例( oracle ) Socket编程实例 ktcl 文件及其冲值卡自服务修改密码例程 一些建议

    Tcl_TK编程权威指南pdf

    hello,world! 变量 命令替换 数学表达式 反斜杠替换 使用花括号和双引号进行分组 过程 一个阶乘的例子 更多有关变量的知识 更多有关数学表达式的内容 注释 有关替换与分组的总结 要点 参考 第2章 ...

    系统学习TCL脚本入门教程

    puts Hello World ;# 这行命令运行出错,被空格分隔 puts "Hello, World - In quotes" ;# 注释 puts {Hello, World - In Braces} # 这行命令运行出错,必须使用 ;# 作为注释符号 puts "This is line 1"; puts "this ...

    天线扫描仿真matlab代码-HelloWorld:演示版

    shell脚本Tcl Eclipse设计环境Oracle SQL Developer Vmware工作站播放器动作脚本PLSQL Dos SVN PVCS Adob​​es Frame Maker Bitbake Yocto INCA Calibration嵌入式系统软件和驱动程序Linux上的Arium和ICE Audio AP

    lua程序设计.pdf

    lua开发文档,当今武林,派别林立,语言繁杂,林林总总不计其数。主流文化的C/C++、Java、 C#、VB;偏安一隅的Fortran;动态语言中的Perl、Tcl、Ruby...可欣赏一下BrainFuck语言1的Hello World程序,语言本身依如其名

    redis 3.2.1 免费下载

    测试命令set hello world get hello 至此redis安装 并且操作成功。 /*******start 脚本*************/ redis的启动脚本在utils中为redis_init_script 其中需要变更下conf的文件路径才能正常使用 阅读全文

    LUA编程(programming in lua)

    编程语言之于程序员,若武功招式之于习武之人,招式虽重要,但在于使用之人。胜者之道,武功只行于表,高手用剑,片草只叶亦威力无穷。...不信可欣赏一下BrainFuck语言1的Hello World程序,语言本身依如其名。

    print不自动换行,puts会自动换行第1/2页

    puts ‘hello world’ puts ‘我们都是’\ ‘中国人’ 运行结果: ruby 代码 3 6hello world 我们都是中国人 2.==,eql?,equal? 区别 ==值相等 eql?值相等,类型相等 equal?值相等,内存地址相等 a=1 b=1.0 c=1.0 d=...

    TCK/TK组合教程

    1.2 hello,world! 1.3 变量 1.4 命令替代 1.5 数学表达式 1.6 反斜杠替代 1.7 花括号和双引号的组合 1.8 过程 1.9 阶乘举例 1.10 有关变量的更多细节 1.11 有关数学表达式的更多细节 1.12 ...

    atdict:活跃的Tcl词典

    @ myobj.greeting -&gt; {who} { puts "Hello, $who!" } 调用方法: @ myobj.greeting: "World" 方法可以通过“ this”变量访问字典: @ myobj.double -&gt; {key} { @ this.$key := {2*[@ this.$key]} } 方法

    禅道自动化测试框架ZenTaoATF.zip

    title: helloworld. expect: helloworld. TC 然后执行zt脚本,zt脚本会扫描当前目录下面的带有用例标志的脚本,然后调用执行,得出每个脚本的实际输出,然后和用例里面事先记录好的预期结果进行比对,如果相匹配,...

    arturo:简单,现代和可移植的解释型编程语言,可高效编写脚本

    print "Hello world!" loop 1..10 'x [ if? even? x - &gt; print [x "is even" ] else - &gt; print [x "is odd" ] ] 很简单,不是吗? :light_bulb: 有关更多示例示例,只需查看/ examples文件夹 文献资料 有关该...

    pycharm新建一个python工程步骤

    小编最近由于工作原因要用到python,一门新的知识需要接触,对于我来说难度还是很大的。 python工程目录结构 ...小技巧:如果版本依赖出问题了,可以手动把lib下面的出sit-packages和tcl8.6这两个文件

    cl-simple-tk:Lisp中TK gui库的简单包装

    简单TK 受python tkinter软件包的启发,这是一个非常简单的tcl/tk包装器,用于普通lisp。 例子 一个带有一个按钮的窗口... :text " Hello world " :command ( lambda () (window-destroy r))))) 上列出了更多示例。

    java基础入门教程

    第 一 章 Java概 述 § 1.1 Java语 言 出 现 的 背景 、 影 响 及 应 用 前 景 一 、 背 景 最 近 一 年 多 来 ,在 Internet上 出 现 的 特 别 吸 引 人 的 事 件 就是 Ja va语 言 和 用 Java编 写 的 浏 览 器...

    Python程序设计(第二版).chm

    The Hello World Selector Section 12.5. Coding for Maintainability Section 12.6. More on HTML and URL Escapes Section 12.7. Sending Files to Clients and Servers Chapter 13. Larger Web Site ...

    Python核心编程第二版

     2.1 程序输出,print语句及“Hello World!”   2.2 程序输入和raw_input()内建函数   2.3 注释   2.4 操作符   2.5 变量和赋值   2.6 数字   2.7 字符串   2.8 列表和元组   2.9 字典...

Global site tag (gtag.js) - Google Analytics