Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

llength (1t)

Name

llength - Count the number of elements in a list

Synopsis

llength list

Description

llength(1t)                  Tcl Built-In Commands                 llength(1t)



______________________________________________________________________________

NAME
       llength - Count the number of elements in a list

SYNOPSIS
       llength list
______________________________________________________________________________

DESCRIPTION
       Treats list as a list and returns a decimal string giving the number of
       elements in it.

EXAMPLES
       The result is the number of elements:

              % llength {a b c d e}
              5
              % llength {a b c}
              3
              % llength {}
              0

       Elements are not guaranteed to be exactly words in a  dictionary  sense
       of course, especially when quoting is used:

              % llength {a b {c d} e}
              4
              % llength {a b { } c d e}
              6

       An empty list is not necessarily an empty string:

              % set var { }; puts "[string length $var],[llength $var]"
              1,0


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+------------------+
       |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
       +---------------+------------------+
       |Availability   | runtime/tcl-8    |
       +---------------+------------------+
       |Stability      | Uncommitted      |
       +---------------+------------------+

SEE ALSO
       list(n),   lappend(n),   lindex(n),  linsert(n),  lsearch(n),  lset(n),
       lsort(n), lrange(n), lreplace(n)

KEYWORDS
       element, list, length



NOTES
       Source code for open source software components in Oracle  Solaris  can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This    software    was    built    from    source     available     at
       https://github.com/oracle/solaris-userland.    The  original  community
       source was downloaded from  http://prdownloads.sourceforge.net/tcl/tcl-
       core8.6.7-src.tar.gz.

       Further information about this software can be found on the open source
       community website at https://www.tcl.tk/.



Tcl                                                                llength(1t)