Meeting a matrix of conditions
Meeting a matrix of conditions
- Subject: Meeting a matrix of conditions
- From: Joseph Weaks <email@hidden>
- Date: Tue, 14 Sep 2004 00:40:10 -0500
I figure there must be a more clever & efficient way to do this:
set x to some item of {"a", "b", "c", "d", "e"}
set y to some item of {"v", "w", "x", "y", "z"}
if (x & y) is in {"av", "bx", "bw", "bz", "dx", "ev"} then
set z to "apple"
else if (x & y) is in {"aw", "cv", "dy", "dz", "ez"} then
set z to "orange"
else if (x & y) is in {"ax", "cw", "cx", "ey"} then
set z to "banana"
else if (x & y) is in {"ay", "cz", "dv", "ew"} then
set z to "mango"
else if (x & y) is in {"az", "bv", "by", "cy", "dw", "ex"} then
set z to "tomato"
end if
I figured coercing into one string was better than
if x = "a" and y = "v" then...
My code breaks it down into many more "else if"'s. The y list in my code actually has about twice this many items.
Ideas on a better way to accomplish this?
Thanks,
Joe Weaks
P.S. Sorry for the poor topic. I could not figure out what to call this arrangement.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden