summaryrefslogtreecommitdiffstats
path: root/doc/lrange.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lrange.n')
-rw-r--r--doc/lrange.n32
1 files changed, 31 insertions, 1 deletions
diff --git a/doc/lrange.n b/doc/lrange.n
index bafc0a2..e2ec3eb 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.7 2004/04/16 22:20:58 dkf Exp $
'\"
.so man.macros
.TH lrange n 7.4 Tcl "Tcl Built-In Commands"
@@ -36,6 +36,36 @@ 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
+% lrange {a b c d e} 0 1
+a b
+.CS
+
+Selecting the last three elements:
+.CS
+% lrange {a b c d e} end-2 end
+c d e
+.CE
+
+Selecting everything except the first and last element:
+.CS
+% lrange {a b c d e} 1 end-1
+b c d
+.CE
+
+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
+% lrange $var 1 1
+{elements to}
+.CE
+
.SH "SEE ALSO"
.VS 8.4
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),