Coding Styles¶
Rules¶
Python |
JavaScript |
C++ |
|
|---|---|---|---|
Code Block Structuring |
Indentation used, typically preceded by a colon [ : ] |
Curly Brackets surrounding nested code [ {} ] |
Curly Brackets surrounding nested code [ {} ] |
Ending a line |
Nothing, just start new line |
Ends with a semicolon [ ; ], (May be optional in some cases) |
Ends with a semicolon [ ; ] |
Variable Creation |
Nothing special, (x = 21) |
Must declare before, (let x = 21) (var y = 19) |
Must declare type before, (int x = 21) |
Common Practices¶
Python |
JavaScript |
C++ |
|
|---|---|---|---|
Indentation |
4 spaces, no tabs |
2 spaces, tabs optional |
2 spaces, tabs optional |
Functions/Methods |
snake_case |
camelCase |
snake_case |
Variables |
snake_case |
camelCase |
snake_case |
Classes |
PascalCase |
PascalCase |
PascalCase |
Constants |
UPPER_SNAKE_CASE |
UPPER_SNAKE_CASE |
UPPER_SNAKE_CASE |