Top-5 case types in programming
A programming case type is the standard programmers follow when they write code, i.e.:
- this-is-an-example
- and_this_is_an_example
- AnotherExample
- andOneMoreExample
- DONE_WITH_EXAMPLES
Here are 5 most common case types:
PascalCase — all the words are written together and each starts with a capital letter
camelCase — all the words are written together and each starts with a capital letter except for the very first one 🐪
snake_case — all the words are separated with _ and all the letters are lowercase 🐍
kebab-case — all the words are separated with — and all the letters are lowercase 🍡
UPPER_CASE_SNAKE_CASE — all the letters are capitalized and the words are separated with _
When you should use which type depends on the programming language and the situation. For instance:
- in JavaScript you should use camelCase for variables and methods and UPPER_CASE_SNAKE_CASE — for constants
- in Ruby you use snake_case for naming variables and methods and PascalCase — for classes and modules
Which case type should you use in CSS? :)