1<HTML><HEAD><TITLE>Built-In Commands - llength manual page</TITLE></HEAD><BODY>
2<H3><A NAME="M2">NAME</A></H3>
3llength - Count the number of elements in a list
4<H3><A NAME="M3">SYNOPSIS</A></H3>
5<B>llength </B><I>list</I><BR>
6<H3><A NAME="M4">DESCRIPTION</A></H3>
7Treats <I>list</I> as a list and returns a decimal string giving
8the number of elements in it.
9
10<H3><A NAME="M5">EXAMPLES</A></H3>
11The result is the number of elements:
12<PRE>% <B>llength</B> {a b c d e}
135
14% <B>llength</B> {a b c}
153
16% <B>llength</B> {}
170</PRE>
18<P>
19Elements are not guaranteed to be exactly words in a dictionary sense
20of course, especially when quoting is used:
21<PRE>% <B>llength</B> {a b {c d} e}
224
23% <B>llength</B> {a b { } c d e}
246</PRE>
25<P>
26An empty list is not necessarily an empty string:
27<PRE>% set var { }; puts &quot;[string length $var],[<B>llength</B> $var]&quot;
281,0</PRE>
29<H3><A NAME="M6">SEE ALSO</A></H3>
30<B><A HREF="../TclCmd/list.htm">list</A></B>, <B><A HREF="../TclCmd/lappend.htm">lappend</A></B>, <B><A HREF="../TclCmd/lindex.htm">lindex</A></B>, <B><A HREF="../TclCmd/linsert.htm">linsert</A></B>, <B><A HREF="../TclCmd/lsearch.htm">lsearch</A></B>, <B><A HREF="../TclCmd/lset.htm">lset</A></B>, <B><A HREF="../TclCmd/lsort.htm">lsort</A></B>, <B><A HREF="../TclCmd/lrange.htm">lrange</A></B>, <B><A HREF="../TclCmd/lreplace.htm">lreplace</A></B>
31<H3><A NAME="M7">KEYWORDS</A></H3>
32<A href="../Keywords/E.htm#element">element</A>, <A href="../Keywords/L.htm#list">list</A>, <A href="../Keywords/L.htm#length">length</A>
33<HR><PRE>
34<A HREF="../copyright.htm">Copyright</A> &#169; 1993 The Regents of the University of California.
35<A HREF="../copyright.htm">Copyright</A> &#169; 1994-1996 Sun Microsystems, Inc.
36<A HREF="../copyright.htm">Copyright</A> &#169; 2001 Kevin B. Kenny. All rights reserved.
37<A HREF="../copyright.htm">Copyright</A> &#169; 1995-1997 Roger E. Critchlow Jr.</PRE>
38</BODY></HTML>
39