• 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: Logical expressions ("and" and "or")
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Logical expressions ("and" and "or")


  • Subject: Re: Logical expressions ("and" and "or")
  • From: Andrew Oliver <email@hidden>
  • Date: Sun, 23 Feb 2003 14:26:16 -0800

Yes, it is also true in AppleScript.

According to
http://developer.apple.com/techpubs/macosx/Carbon/interapplicationcomm/Apple
Script/AppleScriptLangGuide/index.html :

> When evaluating expressions containing the And operator, AppleScript checks
> the leftmost operand first. If its value is false , AppleScript does not
> evaluate the rightmost operand, because it already knows the expression is
> false . (This behavior is sometimes called short-circuiting.)

The same is true (no pun intended) for other operators, as appropriate.

Andrew
:)

On 2/23/03 1:56 PM, "Jeffrey Mattox" <email@hidden> wrote:

> A significant feature of the C language is that logical expressions
> connected by && ("and") and || ("or") are evaluated left to right,
> and evaluation stops as soon as the truth or falsehood of the result
> is known [K&R, section 2.6].
>
> Is this also true in AppleScript? If so, conditionals can be
> optimized, a little.
>
> Jeff
> _______________________________________________
> 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.
_______________________________________________
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.

References: 
 >Logical expressions ("and" and "or") (From: Jeffrey Mattox <email@hidden>)

  • Prev by Date: Logical expressions ("and" and "or")
  • Next by Date: Re: Understanding a repeat loop (strings/characters)
  • Previous by thread: Logical expressions ("and" and "or")
  • Next by thread: Re: Logical expressions ("and" and "or")
  • Index(es):
    • Date
    • Thread