summaryrefslogtreecommitdiffstats
path: root/doc/lassign.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lassign.n')
-rw-r--r--doc/lassign.n11
1 files changed, 8 insertions, 3 deletions
diff --git a/doc/lassign.n b/doc/lassign.n
index 57bd7b4..f2bfcda 100644
--- a/doc/lassign.n
+++ b/doc/lassign.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: lassign.n,v 1.6 2008/09/26 19:12:40 dgp Exp $
+'\" RCS: @(#) $Id: lassign.n,v 1.7 2008/10/17 10:22:25 dkf Exp $
'\"
.so man.macros
.TH lassign n 8.5 Tcl "Tcl Built-In Commands"
@@ -16,7 +16,6 @@ lassign \- Assign list elements to variables
.SH SYNOPSIS
\fBlassign \fIlist \fR?\fIvarName ...\fR?
.BE
-
.SH DESCRIPTION
.PP
This command treats the value \fIlist\fR as a list and assigns
@@ -26,8 +25,10 @@ than list elements, the remaining variables are set to the empty
string. If there are more list elements than variables, a list of
unassigned elements is returned.
.SH EXAMPLES
+.PP
An illustration of how multiple assignment works, and what happens
when there are either too few or too many elements.
+.PP
.CS
lassign {a b c} x y z ;# Empty return
puts $x ;# Prints "a"
@@ -43,15 +44,19 @@ lassign {f g h i} x y ;# Returns "h i"
puts $x ;# Prints "f"
puts $y ;# Prints "g"
.CE
+.PP
The \fBlassign\fR command has other uses. It can be used to create
the analogue of the
.QW shift
command in many shell languages like this:
+.PP
.CS
set ::argv [lassign $::argv argumentToReadOff]
.CE
.SH "SEE ALSO"
lindex(n), list(n), lset(n), set(n)
-
.SH KEYWORDS
assign, element, list, multiple, set, variable
+'\"Local Variables:
+'\"mode: nroff
+'\"End: