summaryrefslogtreecommitdiffstats
path: root/doc/llength.n
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-04-16 22:20:55 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-04-16 22:20:55 (GMT)
commit52abe65a5f5579fb24ba16793f367efdca4b216d (patch)
tree515875301b5f35918e582aa3d36cef09b4824dce /doc/llength.n
parent79f407d4f411f9c26a8fb3bbda9c76112b7f444e (diff)
downloadtcl-52abe65a5f5579fb24ba16793f367efdca4b216d.zip
tcl-52abe65a5f5579fb24ba16793f367efdca4b216d.tar.gz
tcl-52abe65a5f5579fb24ba16793f367efdca4b216d.tar.bz2
Add more examples to documentation along the lines of David Welton's project.
Diffstat (limited to 'doc/llength.n')
-rw-r--r--doc/llength.n28
1 files changed, 27 insertions, 1 deletions
diff --git a/doc/llength.n b/doc/llength.n
index 68dd1d8..f784614 100644
--- a/doc/llength.n
+++ b/doc/llength.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: llength.n,v 1.6 2001/11/14 23:38:39 hobbs Exp $
+'\" RCS: @(#) $Id: llength.n,v 1.7 2004/04/16 22:20:58 dkf Exp $
'\"
.so man.macros
.TH llength n "" Tcl "Tcl Built-In Commands"
@@ -23,6 +23,32 @@ llength \- Count the number of elements in a list
Treats \fIlist\fR as a list and returns a decimal string giving
the number of elements in it.
+.SH EXAMPLES
+The result is the number of elements:
+.CS
+% llength {a b c d e}
+5
+% llength {a b c}
+3
+% llength {}
+0
+.CE
+
+Elements are not guaranteed to be exactly words in a dictionary sense
+of course, especially when quoting is used:
+.CS
+% llength {a b {c d} e}
+4
+% llength {a b { } c d e}
+6
+.CE
+
+An empty list is not necessarily an empty string:
+.CS
+% set var { }; puts "[string length $var],[llength $var]"
+1,0
+.CE
+
.SH "SEE ALSO"
.VS 8.4
list(n), lappend(n), lindex(n), linsert(n), lsearch(n),