What is CamelCase? UpperCamelCase vs lowerCamelCase

CamelCase is a name that programmers use to describe code. It’s also called bicapitalization, InterCaps, medial capitals, Bumpy Case, and Pascal Case.

CamelCase is a way of naming and writing code that eliminates confusion. It starts with a lowercase letter for the first word in an identifier or uppercase letter without an identifier, followed by capitalization after each subsequent word. The last word is also capped but has no space between it and the next identifier. For example, “camelcase” would be written as “CamelCase” or “camelCase”.

//UpperCamelCase for class name and lowerCamelCase for variable and function name:
class ProductDelivery extends APIController {
    protected $productName;
    public function getProductBrand(){
        
    }
}

The term comes from the way the lettering looks when it’s written in this style. For example, “TheQuickBrownFoxJumpedOverTheLazyDog.” You can see how each word begins with an uppercase and then has some letters that are lowercase but most of them also have an uppercase letter somewhere in them as well.

As you see in the example, internal capital letters resemble the humps on a camel’s back.

2 types of CamelCase

There are two types of CamelCase: UpperCamelCase and lowerCamelCase.

UpperCamelCase is often used as Class name in most programming languages, while LowerCamelcase is more common when mentioning variable names or anything that’s not a class name.

The style you use usually depends on what the language supports best (some do not support either).

Leave a Comment

Your email address will not be published. Required fields are marked *


Scroll to Top

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close