Skip to content

Commit 8c18714

Browse files
authored
Merge pull request #10780 from Lexyth/patch-2
Update Enum names, improve enum member names, and add related suggestion
2 parents fb1f3c8 + 49b3281 commit 8c18714

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

tutorials/scripting/gdscript/gdscript_styleguide.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,11 @@ indentation level to distinguish continuation lines:
186186
"Job": "Mechanic",
187187
}
188188

189-
enum Tiles {
190-
TILE_BRICK,
191-
TILE_FLOOR,
192-
TILE_SPIKE,
193-
TILE_TELEPORT,
189+
enum Tile {
190+
BRICK,
191+
FLOOR,
192+
SPIKE,
193+
TELEPORT,
194194
}
195195

196196
**Bad**:
@@ -211,11 +211,11 @@ indentation level to distinguish continuation lines:
211211
"Job": "Mechanic",
212212
}
213213

214-
enum Tiles {
215-
TILE_BRICK,
216-
TILE_FLOOR,
217-
TILE_SPIKE,
218-
TILE_TELEPORT,
214+
enum Tile {
215+
BRICK,
216+
FLOOR,
217+
SPIKE,
218+
TELEPORT,
219219
}
220220

221221
Trailing comma
@@ -738,7 +738,7 @@ underscore (\_) to separate words:
738738

739739
const MAX_SPEED = 200
740740

741-
Use PascalCase for enum *names* and CONSTANT\_CASE for their members, as they
741+
Use PascalCase for enum *names* and keep them singular, as they represent a type. Use CONSTANT\_CASE for their members, as they
742742
are constants:
743743

744744
::
@@ -872,7 +872,7 @@ variables, in that order.
872872

873873
signal player_spawned(position)
874874

875-
enum Jobs {
875+
enum Job {
876876
KNIGHT,
877877
WIZARD,
878878
ROGUE,
@@ -882,7 +882,7 @@ variables, in that order.
882882

883883
const MAX_LIVES = 3
884884

885-
@export var job: Jobs = Jobs.KNIGHT
885+
@export var job: Job = Job.KNIGHT
886886
@export var max_health = 50
887887
@export var attack = 5
888888

0 commit comments

Comments
 (0)