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: Paul Berkowitz <email@hidden>
- Date: Mon, 11 Feb 2002 12:43:55 -0800
On 2/11/02 12:14 PM, "email@hidden" <email@hidden> wrote:
>
A quick example that comes to mind is something that would compare entries in
>
a series of records to 100 possible nation-prefix area codes to determine the
>
time zone offset. Nesting 100 if/elseif statements would be a cludge at best.
>
You could use the whose statement, as suggested Bryan Kaufman in a separate
>
email (thanks!), but that doesn't change my personal wish for a case
>
statement more times than I care to admit :)
But the whole point of else if is that they don't actually have to be nested
at all. They're linear, all at the same level, just like 'case'. i can't see
any difference whatsoever. i don't see why speed is an issue either. It'
just the same:
if theVariable = "Case 1" then
--do this
else if theVariable = "Case 2" then
--do this
else if theVariable = "Case 3" then
--do this
else if theVariable = "Case 4" then
--do this
else if theVariable = "Case 5" then
--do this
-- etc. up to 100
end if
When I step through scripts of this type with Script Debugger, I notice that
the line moves _immediately_ from the first 'if' line to the correct 'else
if' line without checking intermediate lines. Even if it does checl them
behind the scenes, it's awfully fast, and i can't see how
case 1
-- do this
case 2
-- do this
case 3
-- do this
case 4
-- do this
case 5
-- do this
end
would be any different. What's the difference?
--
Paul Berkowitz
_______________________________________________
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.