B.3. Lists

This section summarizes properties of list object and element specifiers.

B.3.1. List Class Properties

The following table provides the properties for the list class.

PropertyMeaning
lengthThe number of items in the list
reverseThe list with its items in reverse order
restItems 2 through the end of the list

B.3.2. Element Specifiers

The following table summarizes the ways to specify items in a list.

Item SpeciferMeaning
first item, second item, third item, ..., tenth itemA specific item by number
1st item, 2nd item, 3rd item, ...A specific item by number
item 1, item 2, item 3...A specific item by number
item −1, item −2, item −3An item relative to the last item; where −1 references the last item
beginningFirst item
last item or endLast item
some itemA random item
middle itemThe middle item; item (n +1) div 2, where n is the size of the list
every itemAll items
itemsSame as everyitem
items m through n

or

items m thru n
Items m through n; can use beginning for m and end for n

Get Beginning AppleScript® 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.