Casings in Programming

Casings in Programming

As we know, naming any variable, function, object etc is quite important in the field of programming, so there are different casing types used to create the name.

The question arising that what is casing, so casing is a method or procedure through which we are able to create the name of any variable, function and so on.

Casing makes our declaration meaningful and easily understandable by anyone.

While creating the name, we should always neglect the space or blanks in between the name. We should always create a name in one word.

If you create the variable given below in the code, then you will get an error in the code.

number of donuts = 34 // This will gives an error

Types of casings -

  • Snake Case

  • Kebab Case

  • Pascal Case

  • Camel Case

These are the most important cases used in the field of programming,

1 - Snake case ->

In a snake case, we should always use an underscore( _ ) in between the name.

All the letters should be written in lowercase.

Let us take an example for a better illustration -

let no_of_students  = 100;

Important point - There is another version of the snake case in which all the letters is in uppercase it is known as the all-caps version of a snake case.

It is mostly used when we want to declare the constant in our program.

const NUMBER_OF_DONUTS = 34

const FAVE_PHRASE = "Hello World

2 - Kebab case ->

The Kebeb case is quite similar to the snake case but in a Kebab case dash( - ) is used in between the letter instead of an underscore( _ ).

All the letters should be written in lowercase ( Same as in snake case).

The first letter of each word is always in lowercase.

Let us take an example for a better illustration -

let no-of-students  = 100;

3 - Pascal case ->

In Pascal's case, the first letter or first word is always in a capital letter or uppercase letter.

This is the most commonly used case.

So, In a Pascal case, every word should start with an uppercase letter.

Let us take an example for a better illustration -

let NoOfStudents  = 100;

4 - Camel case ->

In Camel's case, the first letter or first word is always in a small letter or lowercase letter.

This is the most commonly used case.

So, In a camel case, every word should start with a lower letter and other word start with an uppercase.

Let us take an example for a better illustration -

let noOfStudents  = 100;

Thank you for reading the blog, hope the concept gets crystal clear in your mind.

Connect with me -->

https://www.linkedin.com/in/ankit-singh-mehra-03a211245/