Inspection Details

BooleanAssignedInIfElse


Summary
Identifies redundant Boolean expressions in conditionals.
Reasoning
A Boolean expression never needs to be compared to a Boolean literal in a conditional expression.
The following code example(s) would trigger this inspection:

Public Sub DoSomething(ByVal foo As Boolean)
    If foo = True Then ' foo is known to already be a Boolean value.
        ' ...
    End If
End Sub

The following code example(s) would not trigger this inspection:

Public Sub DoSomething(ByVal foo As Boolean)
    If foo Then
        ' ...
    End If
End Sub


Back to List