• 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
Re: Since Apple Listens to this List... [Case Statements]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Since Apple Listens to this List... [Case Statements]


  • Subject: Re: Since Apple Listens to this List... [Case Statements]
  • From: Scott Griffitts <email@hidden>
  • Date: Thu, 14 Feb 2002 01:09:43 -0600

Case of x
Case is y1
-- Do this is x is y1
end -- y1 (this replaces the break)
Case is y2
-- Do this if x is y2
end -- y2
Case is y3
-- Do this if x is y3
end --y3
end -- Case

some other approaches:

VBScript

select case x
case y1
-- do this if x is y1
case y2
-- do this if x is y2
case y3
-- do this if x is y3
case else
-- do this if ((x != y1) && (x != y2) && (x != y3))
end select

Python

if x == y1:
-- do this if x is y1
elif x == y2:
-- do this if x is y2
elif x == y3:
-- do this if x is y3
else:
-- do this if ((x != y1) && (x != y2) && (x !=y3))

Since Python requires precise indentation, you don't need an "end case" or "end select" type statement. Maybe a little Python/VBScript hybrid (with brackets, a la C, to negate an "end case" statement) would work:

select case x {
case y1:
-- do this if x is y1
case y2:
-- do this if x is y2
case y3:
-- do this if x is y3
case else:
-- do this if ((x != y1) && (x != y2) && (x != y3))
}
_______________________________________________
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.

  • Prev by Date: Re: Since Apple Listens to this List... [Case Statements]
  • Next by Date: Re: Son of Y2.401K
  • Previous by thread: Re: Since Apple Listens to this List... [Case Statements]
  • Next by thread: Re: Since Apple Listens to this List... [Case Statements]
  • Index(es):
    • Date
    • Thread