1. Everything Is A String
The types of variables are not declared in Tcl. There is no need since there is only one
type: string. Every value is a string. Numbers are strings. Even commands and variables
are strings! The following commands set the variable name to the string value "Don", the
variable word to the value "foobar", and the variable pi to "3.14159".
set name Don
set word foobar
set pi 3.14159
Variable names, values, and commands are case sensitive. So the variable name is
different than Name.
To access a variable's value, prefix the variable name with a dollar sign ($). The
following command sets the variable phrase to foobar by retrieving it from the
variable word.
set phrase $word
阅读(714) | 评论(0) | 转发(0) |