Skip to content

Instantly share code, notes, and snippets.

@GLMeece
Last active November 8, 2021 22:24
Show Gist options
  • Save GLMeece/5324b87336f6750f9e5ededfd07d1487 to your computer and use it in GitHub Desktop.
Save GLMeece/5324b87336f6750f9e5ededfd07d1487 to your computer and use it in GitHub Desktop.
Variable/Constant Casing Styles

Computer Language Case Styles

A quick discussion of the most popular ways to invoke variable (or constant) names using case and/or space replacement.

These styles are:

  • camelCase
  • PascalCase
  • snake_case
  • kebab-case

Note: Unless otherwise indicated, languages without parenthetical explanation are referencing variable conventions.

camelCase

AKA, Dromedary Camel Case (a Dromedary Camel has one less hump than a Bactrian Camel)

  • Example: firstLetterIsLowerCaseFollowedByWordCaps
  • Languages: JavaScript (variable & function names), Golang, Java

PascalCase

AKA, UpperCamelCase, StudlyCase

  • Example: EveryWordIsTitleCased
  • Languages: JavaScript, Golang (public structs or functions), Java & Python (Classes)

snake_case

  • Example: words_are_lower_cased_with_underscores_in_between
  • Languages: Python, Ruby

CAPITALIZED_SNAKE_CASE

  • Example: WORDS_ARE_UPPER_CASED_WITH_UNDERSCORES_IN_BETWEEN
  • Languages: Python & JavaScript (constants)

kebab-case

  • Example: words-are-lower-cased-with-hyphens-in-between
  • Languages: HTML5, CSS (attributes, property names)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment