1llength(n) Tcl Built-In Commands llength(n)
2
3
4
5______________________________________________________________________________
6
8 llength - Count the number of elements in a list
9
11 llength list
12______________________________________________________________________________
13
15 Treats list as a list and returns a decimal string giving the number of
16 elements in it.
17
19 The result is the number of elements:
20
21 % llength {a b c d e}
22 5
23 % llength {a b c}
24 3
25 % llength {}
26 0
27
28 Elements are not guaranteed to be exactly words in a dictionary sense
29 of course, especially when quoting is used:
30
31 % llength {a b {c d} e}
32 4
33 % llength {a b { } c d e}
34 6
35
36 An empty list is not necessarily an empty string:
37
38 % set var { }; puts "[string length $var],[llength $var]"
39 1,0
40
42 list(n), lappend(n), lindex(n), linsert(n), lsearch(n), lset(n),
43 lsort(n), lrange(n), lreplace(n)
44
46 element, list, length
47
48
49
50Tcl llength(n)