If else 
ID | STAT-5 |
Title | Every if shall have an else section. |
Priority | Strongly recommended |
Severity level | 10 |
Description | Every if shall have an else section, even if it does not contain executable code. |
Rationale | By including an else section, no execution paths are overlooked. Additionally, code coverage can be accurately reported because without else , it is unclear whether the if -condition is ever false . |
Avoid:
if x > 0
saveData()
end
Instead use:
if x > 0
saveData()
else
% Do not save data.
end