Re: Since Apple Listens to this List... [Case Statements]
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.