Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You already know how to use loops, conditionals, and variables inside your AppleScripts. In this section, I'm going to talk about how to use these and other valuable tools inside subroutines. You already know that any variable names you use for arguments stay local to the subroutine. Here are some other things you can do inside a subroutine:
You can use any repeat loop you like.
You can use conditionals.
You can do just about anything you like, except define another subroutine within a subroutine.