Re: Avoiding repetition
Re: Avoiding repetition
- Subject: Re: Avoiding repetition
- From: Michelle Steiner <email@hidden>
- Date: Thu, 15 Jul 2004 13:08:30 -0700
On Jul 15, 2004, at 12:14 PM, Bernard Azancot wrote:
>
Is there a way to avoid repeating 7 times the same boring code lines
>
with 2 bound variables (day and folder) ?
Put the action in a handler, and send it the variables.
set myDay to Wednesday
set dayList to {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,
Sunday}
set folderList to {FolderA, FolderB, FolderC, FolderD, FolderE,
FolderF, FolderG}
repeat with i from 1 to 7
if item i of dayList is myDay then
set actionFolder to item i of folderList
exit repeat
end if
end repeat
my action(myDay, actionFolder)
on action(theDay, theFolder)
-- do something
end action
--
"Beware the march of ideas."
[demime 0.98b removed an attachment of type application/pgp-signature which had a name of PGP.sig]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.