diff options
author | Jacob Ritchie <jacob.w.k.ritchie@gmail.com> | 2016-05-27 11:25:13 +0200 |
---|---|---|
committer | ven <vendethiel@hotmail.fr> | 2016-05-27 11:25:13 +0200 |
commit | 2b7eadaa80204deef013afcb6e6793b819dbab30 (patch) | |
tree | bd818632d24bd43b91a58d5a74d2077fe9b24aca | |
parent | cdc8ff6e6cf1d14ec6cf4efd8820b46e64b8dc16 (diff) |
Edited tcl.html.markdown to fix a few bugs in the code and formatting error. (#1777)
-rw-r--r-- | tcl.html.markdown | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tcl.html.markdown b/tcl.html.markdown index b90bd690..4ff1d3cc 100644 --- a/tcl.html.markdown +++ b/tcl.html.markdown @@ -105,12 +105,14 @@ set greeting $greeting1$greeting2[set greeting3] # Command substitution should really be called script substitution, because an # entire script, not just a command, can be placed between the brackets. The # "incr" command increments the value of a variable and returns its value. + +set i 0 set greeting $greeting[ incr i incr i incr i ] - +# i is now 3 # backslash suppresses the special meaning of characters set amount \$16.42 @@ -149,9 +151,6 @@ set greeting "Hello, [set {first name}]" # To promote the words within a word to individual words of the current # command, use the expansion operator, "{*}". -``` - -```tcl set {*}{name Neo} # is equivalent to @@ -261,10 +260,11 @@ proc greet greeting\ name return\ \"Hello,\ \$name! # When the last parameter is the literal value, "args", it collects all extra # arguments when the command is invoked proc fold {cmd args} { - set res 0 + set res 1 foreach arg $args { set res [$cmd $res $arg] } + return res } fold ::tcl::mathop::* 5 3 3 ;# -> 45 |