4.8. Summary

In this chapter, I showed you how easy it is to write program loops in AppleScript using the repeat statement. This statement enables you to repeatedly execute a set of statements. You learned the following:

  • The repeat...times statement is used to repeat a set of statements a predetermined number of times.

  • The repeat with statement is used to repeat a set of statements given a starting number, an ending number, and an optional increment.

  • The second form of the repeat with is used to sequence through the elements in a list.

  • The repeat while statement causes a set of statements to be executed as long as a particular condition is true, whereas the repeat until statement causes a set of statements to be executed until a particular condition is satisfied.

I show you many more examples of repeat statements throughout this book.

In the next chapter, you learn to work with strings, including how to reference elements of a string. Before proceeding, however, try the exercises that follow to test your understanding of the material covered in this chapter. You can find the solutions to these exercises in Appendix A.

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.