63 033
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #28691 in C# for Mohammad

Question #28691
what does "if (( a & b ) == b)" mean?
for Example:
if ((e.Modifiers & Keys.Shift) == Keys.Shift)
{
lbl.Text += "\n" + "Shift was held down.";
}
Expert's answer
& -the bitwise-AND operator, which compares each bitof its first operand to the corresponding bit of its second operand. If both
bits are 1, the corresponding result bit is set to 1. Otherwise, the
corresponding result bit is set to 0.
In this case, condition "if (( a & b ) ==b)" is TRUE, when a>=b. This construction may be used with 2-byte
variables, when most significant bit is a key, least - modifiers.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions