• 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: Silly question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Silly question


  • Subject: Re: Silly question
  • From: "Clark S. Cox III" <email@hidden>
  • Date: Fri, 21 Dec 2001 11:50:16 -0500

Craig S. Cottingham wrote:
...I don't instantly know if it will be evaluated as
( (a && b) || (c && d) )
or
( ( (a && b) || c) && d)

To keep the precedence sorted out, just remember that && is boolean multiplication, and || is boolean addition, so 'and' comes before 'or', just as multiplication comes before addition:

1 * 1 == 1 <-> 1 && 1 == 1
1 * 0 == 0 <-> 1 && 0 == 0
0 * 1 == 0 <-> 0 && 1 == 0
0 * 0 == 0 <-> 0 && 0 == 0

1 + 1 == 10 <-> 1 || 1 == 1
1 + 0 == 1 <-> 1 || 0 == 1
0 + 1 == 1 <-> 0 || 1 == 1
0 + 0 == 0 <-> 0 || 0 == 0


--
Clark S. Cox, III
email@hidden
http://www.whereismyhead.com/clark/


References: 
 >Re: Silly question (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: CriticalAlert
  • Next by Date: Critical Alert - another question
  • Previous by thread: Re: Silly question
  • Next by thread: Use -display INSTEAD of -setNeedsDisplay:
  • Index(es):
    • Date
    • Thread