Sunday, June 25, 2017

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

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

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

Applescript:

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
try
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.

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.036 seconds, 11 queries executed ]

RSS (new topics) RSS (active topics)