# |= how does this operator work??

Fedry Kemilau
Ranch Hand
Posts: 44
Hi all,

My question is what i put in the title.

Thanks,
Fedry

Doug Connor
Greenhorn
Posts: 1
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
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
nope.

What i mean is |= not !=

Joanne Neal
Rancher
Posts: 3742
16
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
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
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
"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