• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

|= how does this operator work??

 
Fedry Kemilau
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

My question is what i put in the title.

Thanks,
Fedry
 
Doug Connor
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't you mean !=, which is "not equal to"?

Then you could do somthing like


[ December 11, 2007: Message edited by: Doug Connor ]
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Fedry,
Hi all,

My question is what i put in the title.


If you mean '!=' its a not equal operator.But,when you want to check equality condition with Strings you cannot use this operator. There you have to use .equals() method.
 
Fedry Kemilau
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nope.

What i mean is |= not !=

 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming it's not a typo, then it does a bitwise OR of the left and right hand variables and assigns the result to the left hand variable;
e.g this will set i to 13
 
Fedry Kemilau
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joanne,

Thank you. Actually I don't understand about bitwise and how does the result become 13. I'll try to google it..

rgds,
Fedry
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Fedry Kemilau:
Hi Joanne,

Thank you. Actually I don't understand about bitwise and how does the result become 13. I'll try to google it..

rgds,
Fedry


Its just a Bitwise OR operation.As of previous thread take values

5 -> 0101
12 -> 1100

After applying OR operation you will get 1101 (which is 13).
 
fred rosenberger
lowercase baba
Bartender
Posts: 12143
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"bitwise or" means that you compare the two values literally bit by bit, and 'or' the result.

so, with i = 5, you have 0101
and with j = 12, you have 1100

or each bit colum giving 1101

which converts to 13
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic