Back

VB026

IIf evaluates both branches

Visual Basic 6
Warning
VB6

IIf is a function, not a conditional — both branches run every time, so a guard inside it guards nothing

IIf is a function, not a conditional — both branches run every time, so a guard inside it guards nothing.

Why this severity

IIf is a function, not a conditional — both branches run every time, so a guard inside it guards nothing.


Known false positives

IIf over two side-effect-free constants is safe, merely slower.

Remediation example

If obj Is Nothing Then name = "" Else name = obj.Name

Reconnecting… Connection lost. Reload