You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hugo Lindström edited this page Apr 10, 2025
·
1 revision
Naming
Variable names should be written in snake_case. Constants should be written in UPPER_SNAKE_CASE.
Indentation
Indentation should be 4 spaces.
Line length
Lines should be at most 80 characters long.
Curly braces
Curly braces should be on the same line as the statement.
Conditionals and loops
There shoulde be no parentheses around the condition / declaration.
Magic numbers
Magic numbers should be avoided.
Use constants instead.
Use the -M flag to disable magic number warnings.
Unused values
All values should be used.
If a value is not used, the interpreter will warn about it.
Allocate the value to _ to indicate that it is not used and to tell the interpreter that it is intentional.
Unused variables
Unused variables should be avoided.
Use the _ character to indicate that a variable is unused.
The interpreter will not warn about unused variables that start with an underscore.
The interpreter will also warn if a variable is assigned but never used after the assignment.
Constants
All values that are not reassigned should be declared as constants.