I have read that b1 |= b2
is the shortcut equivalent to b1 = b1 | b2
. My question is really two-fold:
Isn't "=" an assignment operator rather than a comparison operator? If so, what does it do in this context?
Or, is it a comparison operator here and what scenario exists where you would need to compare a variable to itself (i.e. b1 = b1
)?
(I realize this is probably the newbie-est newb question to ask, but I've only got informal experience writing bash scripts and no educational background in programming. Be kind. ;)
Note: this is in reference to the question here: Shortcut "or-assignment" (|=) operator in Java