Logical

It is common to want to test whether two conditions are both true or only one is true or neither is true.


AND

if (oMyObject = null) & (bUpdate == false) 
{
}

The second condition is only checked if the first one is true. This is often referred to as short circuiting.

if (oMyObject = null) && (bUpdate == false) 
{
}

OR

if (oMyObject = null) | (sFullName == "Steven") 
{
}

The second expression is only evaluated if the first expression is true. This is often referred to as short-circuit evaluation.

if (oMyObject = null) || (sFullName == "Steven") 
{
}

Exclusive OR

Exclusive Or. True if only one statement is true.

if (oMyObject = null) ^ (sFullName == "Steven") 
{
}


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext