1  doubel quotes

  This allows substitutions to occur within the quotations - or "interpolation". The substituted group is then evaluated as a single argument.

puts "The current stock value is $varName" 

  In general, the backslash (\) disables substitution for the single character immediately following the backslash. Any character immediately following the backslash will stand without substitution.

  The final exception is the backslash at the end of a line of text. This causes the interpreter to ignore the newline, and treat the text as a single line of text. The interpreter will insert a blank space at the location of the ending backslash.

 set Z Jinan
set Z_LABEL "The Capitol of Shandong is: " puts "$Z_LABEL $Z" ;# Prints the value of Z
puts "$Z_LABEL \$Z" ;# Prints a literal $Z puts "\nBen Franklin is on the \$100.00 bill" set a 100.00
puts "Washington is not on the $a bill" ;# This is not what you want
puts "Lincoln is not on the $$a bill" ;# This is OK
puts "Hamilton is not on the \$a bill" ;# This is not what you want
puts "Ben Franklin is on the \$$a bill" ;# But, this is OK puts "\n................. examples of escape strings"
puts "Tab\tTab\tTab"
puts "This string prints out \non two lines"
puts "This string comes out\
on a single line"

2  braces

  Double braces disables substitution within braces. Characters within braces are passed to a command exactly as written.

  The only "Backslash Sequence" that is processed within braces is the backslash at the end of a line. This is still a line continuation character.

 set Z Albany
set Z_LABEL "The Capitol of New York is: " puts "\n................. examples of differences between \" and \{"
puts "$Z_LABEL $Z"
puts {$Z_LABEL $Z} puts "\n....... examples of differences in nesting \{ and \" "
puts "$Z_LABEL {$Z}"
puts {Who said, "What this country needs is a good $0.05 cigar!"?} puts "\n................. examples of escape strings"
puts {There are no substitutions done within braces \n \r \x0a \f \v}
puts {But, the escaped newline at the end of a\
string is still evaluated as a space}

3  square brackets

  We obtain the results of a command by placing the command in square brackets ([]). This is the functional equivalent of the back single quote (`) in sh programming, or using the return value of a function in C.

  As the Tcl interpreter reads in a line it replaces all the $variables with their values. If a portion of the string is grouped with square brackets, then the string within the square brackets is evaluated as a command by the interpreter, and the result of the command replaces the square bracketed string.

  The exceptions to this rule are as follows:

  1)  A square bracket that is escaped with a \ is considered as a literal square bracket.

  2)  A square bracket within braces is not modified during the substitution phase.

 set x abc
puts "A simple substitution: $x\n" set y [set x "def"]
puts "Remember that set returns the new value of the variable: X: $x Y: $y\n" set z {[set x "This is a string within quotes within braces"]}
puts "Note the curly braces: $z\n" set a "[set x {This is a string within braces within quotes}]"
puts "See how the set is executed: $a"
puts "\$x is: $x\n" set b "\[set y {This is a string within braces within quotes}]"
# Note the \ escapes the bracket, and must be doubled to be a
# literal character in double quotes
puts "Note the \\ escapes the bracket:\n \$b is: $b"
puts "\$y is: $y"

Tcl之group arguments的更多相关文章

  1. uC/OS-II标志(flag)块

    /*************************************************************************************************** ...

  2. springboot情操陶冶-web配置(七)

    参数校验通常是OpenApi必做的操作,其会对不合法的输入做统一的校验以防止恶意的请求.本文则对参数校验这方面作下简单的分析 spring.factories 读者应该对此文件加以深刻的印象,很多sp ...

  3. 【深度学习】吴恩达网易公开课练习(class1 week4)

    概要 class1 week3的任务是实现单隐层的神经网络代码,而本次任务是实现有L层的多层深度全连接神经网络.关键点跟class3的基本相同,算清各个参数的维度即可. 关键变量: m: 训练样本数量 ...

  4. Neural Networks and Deep Learning(week4)Deep Neural Network - Application(图像分类)

    Deep Neural Network for Image Classification: Application 预先实现的代码,保存在本地 dnn_app_utils_v3.py import n ...

  5. Neural Networks and Deep Learning(week4)Building your Deep Neural Network: Step by Step

    Building your Deep Neural Network: Step by Step 你将使用下面函数来构建一个深层神经网络来实现图像分类. 使用像relu这的非线性单元来改进你的模型 构建 ...

  6. 课程一(Neural Networks and Deep Learning)总结——2、Deep Neural Networks

    Deep L-layer neural network 1 - General methodology As usual you will follow the Deep Learning metho ...

  7. 课程一(Neural Networks and Deep Learning),第四周(Deep Neural Networks)——2.Programming Assignments: Building your Deep Neural Network: Step by Step

    Building your Deep Neural Network: Step by Step Welcome to your third programming exercise of the de ...

  8. C++ Core Guidelines

    C++ Core Guidelines September 9, 2015 Editors: Bjarne Stroustrup Herb Sutter This document is a very ...

  9. 运维利器1-supervisor

    supervisor用来管理进程服务很方便 优点: 1.重启方便,无抖动感 2.可以分组管理进程 3.加入系统自动启动后,可以开机自启,程序异常退出能自动启动 操作: 1.在python沙箱环境下操作 ...

随机推荐

  1. 解决 ko mapping 数组无法添加新对象的问题

    这两天页面模板化的进程有些放缓,使用 ko mapping 插件的情形多了起来.组员经常问到的问题即是往 ko mapping 数组添加新对象时,报找不到方法的错误:而使用 ko.observable ...

  2. 可辨别iPhone真假的网址

    在如下的网址中输入iPhone的序列号,可知道该iPhone的型号,生产日期,激活状态等. 1.http://www.app111.org/ 2.http://act.weiphone.com/wet ...

  3. PowerDesign不让name和code联动

    当name和code一样时,修改name的话,code的值将跟着变动,很不方便.如果能让code不随着name编码就好了. PowerDesign中的选项菜单,在[Tool]-->[Genera ...

  4. string中常用的函数

    string中常用的函数 发现在string在处理这符串是很好用,就找了一篇文章放在这里了.. 用 string来代替char * 数组,使用sort排序算法来排序,用unique 函数来去重1.De ...

  5. how bootstrap fit into our website design?

    在web相关技术中,HTML代表了content,structure, CSS则负责styling,决定内容是如何展示的,javascript则主要负责interactive, behaviour. ...

  6. Qt Assistant介绍

    简介 Qt Assistant也就是我们常说的Qt助手,是一款用于呈现在线文档的工具. 简介 一分钟学会使用 Qt参考文档 Qt Assistant详解 命令行选项 工具窗口 文档窗口 工具栏 菜单 ...

  7. (C#基础) byte[] 之初始化, 赋值,转换。

    byte[] 之初始化赋值 用for loop 赋值当然是最基本的方法,不过在C#里面还有其他的便捷方法. 1. 创建一个长度为10的byte数组,并且其中每个byte的值为0. byte[] myB ...

  8. java-过滤器-监听器-拦截器

    1.过滤器 Servlet中的过滤器Filter是实现了javax.servlet.Filter接口的服务器端程序,主要的用途是过滤字符编码.做一些业务逻辑判断等.其工作原理是,只要你在web.xml ...

  9. 一起学CUDA(一)

    前提是电脑的显卡支持CUDA,N卡一般是支持的,如果是A卡就没办法了.主要针对Windows环境,Linux和Mac也有相应的安装包.CUDA环境搭建:Step1:安装代码环境VS2010:Step2 ...

  10. Android Window 9问9答

    1.简述一下window是什么?在android体系里 扮演什么角色? 答:window就是一个抽象类,他的实现类是phoneWindow.我们一般通过windowManager 来访问window. ...