# Complete Boolean Evaluation

is a property of complex conditional statements in programming and query languages that decides, when evaluation of one part of that statement already determines the result of the whole condition, if the remaining parts are evaluated at all.

Code optimizers will often NOT evaluate boolean expressions completely, and the only case where this might be undesirable, is a relied-upon function call in a later part of the expression.

In this sample written in C, "MyFunc" will NOT be called:

```
int LastChecked=-1, SomeNumber=-5
;
int MyCheck(int i)
{ LastChecked = i;
return (i%25)==0;
}
;
if(SomeNumber>0 && MyCheck(SomeNumber)==TRUE)
[...]
```

Because "SomeNumber" is negative, and the greater-than-zero-comparison is FALSE, the whole AND-condition will result as FALSE - no matter what the "MyCheck" function would return, so the optimizer decides that "MyCheck" will not be called at all.

But in this one written in Basic, "MyFunc" WILL be called:

```
Dim LastChecked As Integer, SomeNumber As Integer
:
Function MyCheck(i As Integer)
LastChecked = i
MyCheck = ((i Mod 25)=0)
End Function
:
SomeNumber = -5
If SomeNumber>0 And MyCheck(SomeNumber)=True Then
[...]
```

This is because the whole Basic family (VB, VBA, VBScript, VB.net) does not optimize away boolean expressions. It lacks different operators for logical AND/OR and arithmetic

AND/OR processing.