diff options
Diffstat (limited to 'doc/lassign.n')
| -rw-r--r-- | doc/lassign.n | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/doc/lassign.n b/doc/lassign.n index d23509a..7b3bcdc 100644 --- a/doc/lassign.n +++ b/doc/lassign.n @@ -4,7 +4,7 @@ '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" +'\" .TH lassign n 8.5 Tcl "Tcl Built-In Commands" .so man.macros .BS @@ -12,8 +12,9 @@ .SH NAME lassign \- Assign list elements to variables .SH SYNOPSIS -\fBlassign \fIlist \fR?\fIvarName ...\fR? +\fBlassign \fIlist varName \fR?\fIvarName ...\fR? .BE + .SH DESCRIPTION .PP This command treats the value \fIlist\fR as a list and assigns @@ -23,40 +24,32 @@ 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 -\fBlassign\fR {a b c} x y z ;# Empty return +lassign {a b c} x y z ;# Empty return puts $x ;# Prints "a" puts $y ;# Prints "b" puts $z ;# Prints "c" -\fBlassign\fR {d e} x y z ;# Empty return +lassign {d e} x y z ;# Empty return puts $x ;# Prints "d" puts $y ;# Prints "e" puts $z ;# Prints "" -\fBlassign\fR {f g h i} x y ;# Returns "h i" +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 [\fBlassign\fR $::argv argumentToReadOff] +set ::argv [lassign $::argv argumentToReadOff] .CE .SH "SEE ALSO" -list(n), lappend(n), ledit(n), lindex(n), linsert(n), llength(n), -lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n), -lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n) +lindex(n), list(n), lset(n), set(n) + .SH KEYWORDS assign, element, list, multiple, set, variable -'\"Local Variables: -'\"mode: nroff -'\"End: |
