What is the difference between `on` and `to` in AppleScript handler declaration What is the difference between on and to in AppleScript handler declaration? When to use one or the other?

For example the following handlers do the same:

on demo1()
   return 1
end demo1

to demo2()
   return 1
end demo2
There's no difference between them. Both on and to are acceptable.

From Using Handlers/Functions


  Listing 13-3 shows a variation of the handler in Listing 13-1, which uses the to prefix instead of on. Either syntax is acceptable.


From Handler Reference

( on | to ) handlerName ¬
   [ [ of | in ] directParamName ] ¬
   [ ASLabel userParamName ]... ¬
   [ given userLabel:userParamName [, userLabel:userParamName ]...]
      [ statement ]...
end [ handlerName ]