{

Naming style camel,snake,kebab,pascal cases tutorial example


programming Case name styles

The string is a group of characters that contains word(s). A sentence is a group of strings or words
In programming languages, there are different types of strings cases styles available

There are various case styles for combing words to declare variables or functions or URLs in programming languages, This will be used as conventional notations only.
All programming languages do not follow all cases.

For example, Camel Cases in java are used for declaring variable names, kebab cases are used in lisp language for defining variable names.

We are going to discuss different case strings.

Following are different cases name styles notations available in various programming languages.

Case type Example alternative names
camel case firstName camelCap
snake case first_name underscore case
Kebab case first-name hyphen, dash or caterpillar or lisp or CSS case
Flat case firstname simple case
Flat case firstname simple case
cobol case FULL_NAME FULL CAPS CASE or Train case

Camel case conventional

camel case also abbreviated as camelCase or camel caps

  • the first character of each word in upper case.
  • In programming languages, variables are declared with camel case where the first character of each word is Uppercase except the first word.
  • That means each string starts with lower case.
  • came cases can be FullName or firstName
  • Important points
  • spaces and punctuation in strings not accepted
  • These are conventional notations that only do not have syntax effects.
  • used in declaring variables or member variables for an object in object programming languages like java
  • underscore not accepted

valid camel cases examples are ZipCode, lastName.

Invalid examples are zip code, full_name, phone-number.

snake case strings

These are compound words, each word is separated by underscore symbols

hello_world is a snake case string example.

Important points about snake case sentences

  • Each word is separated by an underscore
  • spaces and punctuation are not allowed
  • these are used in declaring variables and method names in some programming languages
  • starting letter of each word is either lower or uppercase.
  • Convention notation is to use starting letter as lower case.

valid snake case examples are first_name and last_name, Full_name

invalid snake case examples are “first name”, “employee, salary”

Kebab or Hyphen case

Also called hyphen case or dash case, which is used to join the string of words with hyphen symbols, where all the words are in lower case.

Important points

  • each word in a component sentence are separated by hyphen (-) symbols
  • All the words are in lower case only
  • These will be used in declaring variables in the Lisp programming language and also defining URLs with this conventional notation in SEO.

valid names are naming-style-case-example

Invalid names are first_name

Example case styles examples in JavaScript

THE BEST NEWSLETTER ANYWHERE
Join 6,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.

Similar Posts
Subscribe
You'll get a notification every time a post gets published here.