If else cc4m_logo_inline

IDSTAT-5
TitleEvery if shall have an else section.
PriorityRecommended
Severity level9
DescriptionEvery if shall have an else section, even if it does not contain executable code.
RationaleBy 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.
Exceptionselse sections may be omitted in case of input processing or error handling.

Avoid:

if x > 0
    saveData()
end

Instead use:

if x > 0
    saveData()
else
    % Do not save data.
end