Skip to content

Update Enum names, improve enum member names, and add related suggestion #10780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions tutorials/scripting/gdscript/gdscript_styleguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ indentation level to distinguish continuation lines:
"Job": "Mechanic",
}

enum Tiles {
TILE_BRICK,
TILE_FLOOR,
TILE_SPIKE,
TILE_TELEPORT,
enum Tile {
BRICK,
FLOOR,
SPIKE,
TELEPORT,
}

**Bad**:
Expand All @@ -211,11 +211,11 @@ indentation level to distinguish continuation lines:
"Job": "Mechanic",
}

enum Tiles {
TILE_BRICK,
TILE_FLOOR,
TILE_SPIKE,
TILE_TELEPORT,
enum Tile {
BRICK,
FLOOR,
SPIKE,
TELEPORT,
}

Trailing comma
Expand Down Expand Up @@ -738,7 +738,7 @@ underscore (\_) to separate words:

const MAX_SPEED = 200

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

::
Expand Down Expand Up @@ -872,7 +872,7 @@ variables, in that order.

signal player_spawned(position)

enum Jobs {
enum Job {
KNIGHT,
WIZARD,
ROGUE,
Expand All @@ -882,7 +882,7 @@ variables, in that order.

const MAX_LIVES = 3

@export var job: Jobs = Jobs.KNIGHT
@export var job: Job = Job.KNIGHT
@export var max_health = 50
@export var attack = 5

Expand Down
Loading