Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

| and || operators  RSS feed

 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw the post of Nancy about & and &&
It arise me one question
What is difference between | and | | operators
Thanks
Angela
 
Guy Reynolds
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly the same as the difference between & and &&, | is the OR operator and | | is the short-circuit OR operator.
ie, instead of performing logical AND with booleans they perform logical OR with booleans. Also instead of performing bitwise AND with int types, | performs bitwise OR with int types.
[This message has been edited by Guy Reynolds (edited June 26, 2001).]
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
angela
Originally posted by Guy Reynolds:
Exactly the same as & and && except instead of performing logical AND with booleans they perform logical OR with booleans, also instead of performing bitwise AND with int types, | performs bitwise OR with int types.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!