Skip to content
Tcl Source Code Artifact [155e45f148]
Login

Artifact [155e45f148]

Artifact 155e45f14891c37ac8f92b3e594784b578a6923ec107962a89f0defe632c8fa4:


---
CommandName: list
title: list
ManualSection: n
Version: unknown
TclPart: Tcl
TclDescription: Tcl Built-In Commands
Links:
 - lappend(n)
 - lassign(n)
 - ledit(n)
 - lindex(n)
 - linsert(n)
 - llength(n)
 - lmap(n)
 - lpop(n)
 - lrange(n)
 - lremove(n)
 - lrepeat(n)
 - lreplace(n)
 - lreverse(n)
 - lsearch(n)
 - lseq(n)
 - lset(n)
 - lsort(n)
Keywords:
 - element
 - list
 - quoting
Copyright:
 - Copyright (c) 1993 The Regents of the University of California.
 - Copyright (c) 1994-1996 Sun Microsystems, Inc.
 - Copyright (c) 2001 Kevin B. Kenny <[email protected]>. All rights reserved.
---

# Name

list - Create a list

# Synopsis

::: {.synopsis} :::
[list]{.cmd} [arg]{.optdot}
:::

# Description

This command returns a list comprised of all the *arg*s, or an empty string if no *arg*s are specified. Braces and backslashes get added as necessary, so that the [lindex] command may be used on the result to re-extract the original arguments, and also so that [eval] may be used to execute the resulting list, with *arg1* comprising the command's name and the other *arg*s comprising its arguments.  **List** produces slightly different results than [concat]:  [concat] removes one level of grouping before forming the list, while **list** works directly from the original arguments.

# Example

The command

```
list a b "c d e  " "  f {g h}"
```

will return

```
a b {c d e  } {  f {g h}}
```

while [concat] with the same arguments will return

```
a b c d e f {g h}
```


[concat]: concat.md
[eval]: eval.md
[lindex]: lindex.md