Skip to main content

Compiler Error C0218

Message: 'CASE' label requires literal or symbolic integer constant

Possible error cause: An attempt is made to use a variable as a CASE label.

Error correction: Use only literals and symbolic integer constants.

Example 441. Example of the error:
PROGRAM PLC_PRG
VAR
    i : INT;
    a : INT := 2;
END_VAR

CASE i OF
  1: i := i+1;
  a: i := i+2;
ELSE
  i := i+10;
END_CASE;

Message:

C0218: 'CASE' label requires literal or symbolic integer constant