Case statements are syntactic sugar for a series of conditionals that all test the same value for equality.
A case statement with only one item is functionally equivalent to a single if
statement, and a case statement with only one item and an else is functionally
equivalent to an if statement and a corresponding else.
In both these cases, using an if statement would be clearer.
If it is a case statement with one item, replace it with an if statement using
the same condition.
// Noncompliant case MyNum of 0: Exit; end;
// Compliant if MyNum = 0 then begin Exit; end;
If it is a case statement with one item and an else, replace the item with an
if statement using the same condition and a corresponding identical else.
case MyNum of
0: Exit;
else begin
Writeln('Not 0!');
end;
end;
if MyNum = 0 then begin
Exit;
end
else begin
Writeln('Not 0!');
end;