Team LiB   Previous Section   Next Section
continue

Syntax

On parMethod(int )

   If somethingTrue then

      (* code statements here *)

   else

      continue parMethod(int) -- call parent script's parMethod version

   end if

end parMethod

Description

The continue statement is used to call a parent script's method from a child script. In AppleScript, a child script can inherit properties and methods from a parent script. This topic is covered in Chapter 9. The child script specifies its parent (if it has one) by declaring a parent property at the top of the script:

property parent : NameOfScript

The NameOfScriptpart can be either the name of a script object or an application, such as:

application "Finder"

A child script inherits the methods of a parent; it does not have to define these methods. However, the child script can "override" the parent method(s) by redefining them in the body of the script. Within these redefined methods, it can use the continue statement to call the parent method. The following example constitutes a child script that calls its parent's version of the parMethod function based on the magnitude of the numerical argument passed to the method. The child object handles real numbers and the parent handles integers.

Examples

On parMethod(int )

   If (class of int is real) then

      Return (int * 2)

   Else

      continue parMethod(int) (* it's an integer so call the parent 

      parMethod *)

   end if

end parMethod
    Team LiB   Previous Section   Next Section