• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Meeting a matrix of conditions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Meeting a matrix of conditions
      • From: Paul Robinson <email@hidden>
    • Re: Meeting a matrix of conditions
      • From: Paul Robinson <email@hidden>
    • Re: Meeting a matrix of conditions
      • From: Graff <email@hidden>
    • Re: Meeting a matrix of conditions
      • From: Emmanuel <email@hidden>
  • Prev by Date: Re: Photoshop layer mask scripting - stumped
  • Next by Date: Re: String to list conversion
  • Previous by thread: Re: String to list conversion
  • Next by thread: Re: Meeting a matrix of conditions
  • Index(es):
    • Date
    • Thread