<HTML><HEAD><TITLE>Tcl Built-In Commands - lindex manual page</TITLE></HEAD><BODY> <H3><A NAME="M2">NAME</A></H3> lindex - Retrieve an element from a list <H3><A NAME="M3">SYNOPSIS</A></H3> <B>lindex </B><I>list index</I><BR> <H3><A NAME="M4">DESCRIPTION</A></H3> This command treats <I>list</I> as a Tcl list and returns the <I>index</I>'th element from it (0 refers to the first element of the list). In extracting the element, <I>lindex</I> observes the same rules concerning braces and quotes and backslashes as the Tcl command interpreter; however, variable substitution and command substitution do not occur. If <I>index</I> is negative or greater than or equal to the number of elements in <I>value</I>, then an empty string is returned. If <I>index</I> has the value <B>end</B>, it refers to the last element in the list, and <B>end-</B><I>integer</I> refers to the last element in the list minus the specified integer offset. <H3><A NAME="M5">SEE ALSO</A></H3> <B><A HREF="../TkCmd/list.htm">list</A></B>, <B><A HREF="../TkCmd/lappend.htm">lappend</A></B>, <B><A HREF="../TkCmd/linsert.htm">linsert</A></B>, <B><A HREF="../TkCmd/llength.htm">llength</A></B>, <B><A HREF="../TkCmd/lsearch.htm">lsearch</A></B>, <B><A HREF="../TkCmd/lsort.htm">lsort</A></B>, <B><A HREF="../TkCmd/lrange.htm">lrange</A></B>, <B><A HREF="../TkCmd/lreplace.htm">lreplace</A></B> <H3><A NAME="M6">KEYWORDS</A></H3> <A href="../Keywords/E.htm#element">element</A>, <A href="../Keywords/I.htm#index">index</A>, <A href="../Keywords/L.htm#list">list</A> <HR><PRE> <A HREF="../copyright.htm">Copyright</A> © 1993 The Regents of the University of California. <A HREF="../copyright.htm">Copyright</A> © 1994-1996 Sun Microsystems, Inc. <A HREF="../copyright.htm">Copyright</A> © 1995-1997 Roger E. Critchlow Jr.</PRE> </BODY></HTML>