aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-01-24 11:41:46 +1000
committerSteve Bennett <steveb@workware.net.au>2010-10-15 11:02:42 +1000
commit48ff3a2b20e142da6a7bd2f35ba2baca0a4d33ae (patch)
treefc5291883e9d32a491647c169715dd2b100d3da7 /doc
parent47a1141c88d5899325b556666dd27cc75a602b98 (diff)
downloadjimtcl-48ff3a2b20e142da6a7bd2f35ba2baca0a4d33ae.zip
jimtcl-48ff3a2b20e142da6a7bd2f35ba2baca0a4d33ae.tar.gz
jimtcl-48ff3a2b20e142da6a7bd2f35ba2baca0a4d33ae.tar.bz2
Implement and document lassign
Diffstat (limited to 'doc')
-rw-r--r--doc/jim_tcl.txt15
1 files changed, 14 insertions, 1 deletions
diff --git a/doc/jim_tcl.txt b/doc/jim_tcl.txt
index ebac242..eb07e84 100644
--- a/doc/jim_tcl.txt
+++ b/doc/jim_tcl.txt
@@ -43,7 +43,7 @@ The major differences are:
6. Builtin dictionary type (dict)
7. file mkdir, file rename, file tempfile (Tcl 7.x, 8.x)
8. env command to access environment variables
-9. List: lmap, lset, lreverse (Tcl 8.x)
+9. List: lmap, lset, lreverse, lassign (Tcl 8.x)
10. os.fork, os.wait, rand
11. \{*\}/\{expand\}
12. string map (Tcl 7.x)
@@ -2032,6 +2032,19 @@ For example, 'lappend a $b' is much more efficient than
when '$a' is long.
+lassign
+~~~~~~~
++*lassign* 'list varName ?varName? ...'+
+
+This command treats the value *list* as a list and assigns successive elements from that list to
+the variables given by the *varName* arguments in order. If there are more variable names than
+list elements, the remaining variables are set to the empty string. If there are more list ele-
+ments than variables, a list of unassigned elements is returned.
+
+ jim> lassign {1 2 3} a b; puts a=$a,b=$b
+ 3
+ a=1,b=2
+
lindex
~~~~~~
+*lindex* 'list index'+