Basics of AppleScript

Part of List

What if you just want to retrieve just a part of the list?

Script [6.7.1]:

set vowels to {"a", "e", "i", "o", "u"}
set letters to items 2 through 4 of vowels

Explanation: Here I have a list named vowels which contains a, e, i, o and u. But I want only e, i and o.

So with the help of second statement, I am specifying that letters should contain items of vowels from 2 to 4 only.

through is the keyword which helps in creating partition in the list.

However if you are a person who sends a number of messages and uses SMS language then you can use thru instead of through. The output will remain same.

Even if the second statement is changed to,

set letters to items 4 through 2 of vowels

the output, remains same.

Figure 6.7.1

Figure 6.7.1 Partition of List