Sunday, December 4, 2022

#1 2007-03-03 11:44:33 pm

Kevin Bradley
From:: Independence, MO
Registered: 2006-03-13
Posts: 548

Using optional parameters in handlers

An example of optional parameters inside handlers using lists or records. From the AppleScript Users list

OS version: OS X


processArgs({1, 2, 3})
--> 30
processRecord({a:1, b:2, c:3})
--> {3,5}

on processArgs(args)
set x to 5
repeat with arg in args
set x to x * arg
end repeat
end processArgs

on processRecord(hash)
set len to count hash as list
set x to 5
set x to x + (d of hash)
end try
return {len, x}
end processRecord

Nitewing '98
I distrust morning people, largely because I suspect them of getting together early one day while the rest of us were asleep and setting up the rules of civilization.



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)