Back to naming things
Let’s have another look at how to name variables, functions, and classes. Picking the right name for any of these is very important as it will make understanding the code way easier.
Naming conventions
As we saw in Chapters 3 and 4, variable, function, and class names have different constraints. We used specific rules to name each. These ways are called naming conventions. They give a term to how we want to constrain the formation of names. The three main naming conventions that are recommended in the GDScript style guide are as follows:
- snake_case: We have used this naming convention to name all our variables and methods. It is called snake_case because each word is connected by an underscore, which looks like a little snake. Example names could be the following:
player_health
,movement_speed
, andweekly_highscore
. - SCREAMING_SNAKE_CASE: This is the convention we use to name constants. It is exactly the same as snake case, only all the...