Naming Guide

Removing spaces in names

In programming, we remove spaces in the names of variables, functions, and class names as saying I have a variable named High Score, We do not name the variable as High Score = 2500 we instead do not want any space as each word e.g. HighScore = 2500 would be counted as a separate thing instead of our one variable and this would cause an error.

Ways of combing words into names

There are four common cases for joining words for your names.

PascalCase

The first way we can name things in our code is PascalCase, PascalCase works by capitalizing the first letter of each word and removing the spaces.

Example:

Without - High Score = 2500

PascalCase - HighScore = 2500

camelCase

The second way we can name things in our code is camelCase, camelCase works by capitalizing the first letter of each word except for the first word, and removing the spaces.

Example:

Without - High Score = 2500

PascalCase - highScore = 2500

snake_case

The third way we can name things in our code is snake_case, snake_case works by replacing the spaces with underscores.

Example:

Without - High Score = 2500

PascalCase - high_score = 2500

kebab-case

The fourth way we can name things in our code is kebab-case, kebab-case works by replacing the spaces with -.

Example:

Without - High Score = 2500

PascalCase - high_score = 2500

Last updated

Was this helpful?