• 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: Match 'if' Condition and Do Nothing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Match 'if' Condition and Do Nothing


  • Subject: Re: Match 'if' Condition and Do Nothing
  • From: Steve Mills <email@hidden>
  • Date: Sat, 20 Dec 2003 20:20:50 -0600

On Dec 20, 2003, at 13:32, Paul Berkowitz wrote:

On 12/20/03 10:41 AM, "Marconi" <email@hidden> wrote:

In an 'if' statement, I want to check for one of three conditions. To
keep things efficient I want to check in order from the most likely
condition to the least likely condition. If the most likely condition
is present, I want to do nothing. Only the other two conditions
require action. Is the following the correct syntax for this?

if theCondition is MostLikely then -- do nothing but exit the 'if'
else if theCondition is LessLikely then
Do some stuff
else if theCondition is LeastLikely then
do some different stuff
end if


Is this the correct syntax -- just follow 'then' on the first line
with 'else if' on the next?

You can do that. But it's it's simpler just to do this:

if theCondition is LessLikely then
Do some stuff
else if theCondition is LeastLikely then
do some different stuff
end if


as you can see, if the theCondition is MostLikely then nothing else happens,
which is what you want.

But by including the most likely condition, you're making the loop faster (assuming it's in a loop) by only doing one test most of the time instead of doing 2 tests all the time. I assume this is why he put the first test in, because he said "to keep things efficient".

Steve Mills
Drummer, Mac geek
http://sjmills5.home.mchsi.com/
_______________________________________________
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.

  • Follow-Ups:
    • Re: Match 'if' Condition and Do Nothing
      • From: Marconi <email@hidden>
References: 
 >Re: Match 'if' Condition and Do Nothing (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: Help! Need an AppleScript in a hurry! (Create text files based on file names)
  • Next by Date: Re: Help! Need an AppleScript in a hurry! (Create text files based on file names)
  • Previous by thread: Re: Match 'if' Condition and Do Nothing
  • Next by thread: Re: Match 'if' Condition and Do Nothing
  • Index(es):
    • Date
    • Thread