Binary confront

  • Thread starter Thread starter Stefano Galluzzo
  • Start date Start date
S

Stefano Galluzzo

I have a problem. I want do a binary confront.
I have a Variable
1: int visibilityelements;
2: visibilityelements = 2;
if (visibilityelements & 2) {
...

}

if (visibilityelements & 4) {
...

}

if (visibilityelements & 8) {
...

}


if (visibilityelements & 16) {
...

}

The Visual Studio on if write me "Cannot implicitly convert type 'int' to
'bool'" for (visibilityelements & 2)

Anyone can help me, please?

Thanks

Stefano
 
Stefano Galluzzo said:
I have a problem. I want do a binary confront.

Not sure what you mean by a "confront" here, but I think what you want
is:

if ((visibilityElements & 2) != 0)
{
....
}
 
Back
Top