Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

If statement with &

this is a stupid question but not sure why I get this error

 if ((objCont.Cancelcr == objCot.Tetor) & (objContract.Canctor != objContract.Mor))
{
....do something
}

error: invalid expression term >
0
dba123
Asked:
dba123
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
if ((objCont.Cancelcr == objCot.Tetor) && (objContract.Canctor != objContract.Mor))
{
....do something
}


0
 
Bruce_1975Commented:
Are you sure that all objects (or there properties) are of the same type? If not, the == operator will not work and you will get the invalid expression message.

@angelIII:
the && operator is the same than &, but in case the first expression is false, the execution of the second expression will be skipped.
0
 
krushoCommented:
& is a bitwise AND

I think you mean to use && which means if( this and this )
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now