6. Lists

Lists are used in Tcl to deal with collections of things, such as all the users in a group or all the files in a directory or all the options for a widget. Lists allow you to gather together any number of values in one place, pass around the collection as a single entity, and later get the component values back again. A list is an ordered collection of elements where each element can have any string value, such as a number, a person’s name, the name of a window, or a word of a Tcl command. Lists are represented as strings with a particular structure; this means that you can store lists in variables, type them to commands, and nest them as elements of other lists.

6.1 Commands Presented in This Chapter

This chapter describes the structure ...

Get Tcl and the Tk Toolkit, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.