From f3aaa480e20350761876ecfd4a9d83e4ebd8632d Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 20 Dec 2019 19:26:59 +0100 Subject: [PATCH] Add an enum naming guideline to the GDScript style guide This partially addresses #1736. --- .../gdscript/gdscript_styleguide.rst | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/getting_started/scripting/gdscript/gdscript_styleguide.rst b/getting_started/scripting/gdscript/gdscript_styleguide.rst index 4e5654cb6..e909e63cf 100644 --- a/getting_started/scripting/gdscript/gdscript_styleguide.rst +++ b/getting_started/scripting/gdscript/gdscript_styleguide.rst @@ -242,11 +242,24 @@ Use past tense: signal door_opened signal score_changed -Constants -~~~~~~~~~ +Constants and enums +~~~~~~~~~~~~~~~~~~~ -Use CONSTANT\_CASE, all caps, with an underscore (\_) to separate words: -``const MAX_SPEED = 200`` +Use CONSTANT\_CASE, all caps, with an underscore (\_) to separate words. + +Enum *names* (if any) should use PascalCase, but their *values* should be in +CONSTANT\_CASE. + +:: + + const MAX_SPEED = 200 + + enum Element { + EARTH, + WATER, + AIR, + FIRE, + } Static typing -------------