Variables
Naming Rules
Section titled “Naming Rules”-
Always start with a lowercase letter.
-
Subsequent words start with uppercase letters.
-
Do not use underscores
_. -
Numbers from
0to9. -
🐫
Lower camel case.variableName -
❗ If the
variableis related toSafety, the name starts withF_:F_variableName
Examples
Section titled “Examples”VAR // ✅ Correct: isRunning: bool; ready: bool; inHomePos: bool; runForward: bool; status: int;END_VARVAR // ❌ Wrong: is_Runing: bool; READY: bool; in_home_pos: bool; Run_Forward: bool; Status: int; ...END_VARWhen to use _ in a variable?
Section titled “When to use _ in a variable?”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.
Example
Section titled “Example”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_VARVAR // ❌ Wrong: motor1IsRuning: bool; motor1_Ready: bool; motor1warning: bool; error_motor1: bool; 😭😭😭END_VAR