Skip to content

Variables

  1. Always start with a lowercase letter.

  2. Subsequent words start with uppercase letters.

  3. Do not use underscores _.

  4. Numbers from 0 to 9.

  5. 🐫 Lower camel case.

    variableName
  6. ❗ If the variable is related to Safety, the name starts with F_:

    F_variableName
VAR
// ✅ Correct:
isRunning: bool;
ready: bool;
inHomePos: bool;
runForward: bool;
status: int;
END_VAR
VAR
// ❌ Wrong:
is_Runing: bool;
READY: bool;
in_home_pos: bool;
Run_Forward: bool;
Status: int;
...
END_VAR

In principle, we DO NOT recommend the use of the underscore, unless the declared variable needs a semantic separation for structuring and the variable cannot be placed in a structure.

We have motor1 which has the properties isRunning, ready, warning, and error. For various reasons, let’s assume we cannot create a motor1 structure. In that case, and only in that case, we advise using the underscore.

VAR
// ✅ Correct:
motor1_isRunning: bool;
motor1_ready: bool;
motor1_warning: bool;
motor1_error: bool;
END_VAR
VAR
// ❌ Wrong:
motor1IsRuning: bool;
motor1_Ready: bool;
motor1warning: bool;
error_motor1: bool; 😭😭😭
END_VAR