diff options
Diffstat (limited to 'doc/lrange.n')
-rw-r--r-- | doc/lrange.n | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/doc/lrange.n b/doc/lrange.n index bafc0a2..9274f35 100644 --- a/doc/lrange.n +++ b/doc/lrange.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: lrange.n,v 1.6 2001/11/14 23:38:39 hobbs Exp $ +'\" RCS: @(#) $Id: lrange.n,v 1.6.4.1 2004/10/27 12:52:40 dkf Exp $ '\" .so man.macros .TH lrange n 7.4 Tcl "Tcl Built-In Commands" @@ -35,6 +35,35 @@ Note: ``\fBlrange \fIlist first first\fR'' does not always produce the same result as ``\fBlindex \fIlist first\fR'' (although it often does for simple fields that aren't enclosed in braces); it does, however, produce exactly the same results as ``\fBlist [lindex \fIlist first\fB]\fR'' +.SH EXAMPLES +Selecting the first two elements: +.CS +% \fBlrange\fR {a b c d e} 0 1 +a b +.CE +.PP +Selecting the last three elements: +.CS +% \fBlrange\fR {a b c d e} end-2 end +c d e +.CE +.PP +Selecting everything except the first and last element: +.CS +% \fBlrange\fR {a b c d e} 1 end-1 +b c d +.CE +.PP +Selecting a single element with \fBlrange\fR is not the same as doing +so with \fBlindex\fR: +.CS +% set var {some {elements to} select} +some {elements to} select +% lindex $var 1 +elements to +% \fBlrange\fR $var 1 1 +{elements to} +.CE .SH "SEE ALSO" .VS 8.4 |