Skip to main content

SA0078: Missing CASE branches

Detects CASE statements without CASE branches and only one ELSE statement

Justification: A CASE statement without cases wastes execution time and it is difficult to read.

Importance: Medium

Example 85. Example
PROGRAM PLC_PRG
VAR
    iVar : INT;
    xTemp : BOOL;
END_VAR
iVar := iVar + INT#1;
//in the following the case descriptions are missing:
CASE iVar OF
    ELSE
        xTemp := NOT xTemp;
END_CASE

Output in the Messages view:

  • sa_icon_message.png SA0078: Missing CASE branches