Welcome to Admin Junkies, Guest — join our community!

Register or log in to explore all our content and services for free on Admin Junkies.

How to Make Variable Names

Variables are very important in any coding language and first of all, we need to know how to name them.

The following are ways to name them:

Code:
Forum_Name = "Admin Junkies"

_1st_Member = "The Forum Founder"

ForumName = "Admin Junkies"

seo = "search engine optimization"

Jerry = "A new member"

SMF = "Simple Machines Forum"

Some of you can probably see a pattern. In fact, variables can only start with a letter or underscore and can only contain letters, numbers, and underscores and everything from start to finish is case sensitive.

Anyway, one popular way to make variables involves putting an underscore between two words. What might be the most popular style for single word variables?
 
Advertisement Placeholder
What might be the most popular style for single word variables?

Um, just the single word, lowercase? Most languages have the convention that if they're a single word, it's lowercase and if it's a constant it's uppercase.

(The rules beyond that for two or more words vary with language, most languages accept both under_score/snake_case and camelCase for variables, some languages also have rules around PascalCase, and usually a project will decide which it is following as it goes along.)
 
Um, just the single word, lowercase? Most languages have the convention that if they're a single word, it's lowercase and if it's a constant it's uppercase.

(The rules beyond that for two or more words vary with language, most languages accept both under_score/snake_case and camelCase for variables, some languages also have rules around PascalCase, and usually a project will decide which it is following as it goes along.)
Bro Code was saying underscores were most popular for two-word variables.
 
Depends on the language and about a million other things, not to mention the project you're working on.

The code I wrote today has a huge mixture of snake_case and camelCase because some of it is destined for a database where the column names are generally snake_case for consistency (as not all database systems are equal about this) and it has different behaviours in Laravel depending on snake_case or camelCase around object properties as a result where it does some magic from one to the other under the hood.
 

Log in or register to unlock full forum benefits!

Log in or register to unlock full forum benefits!

Register

Register on Admin Junkies completely free.

Register now
Log in

If you have an account, please log in

Log in
Who read this thread (Total readers: 0)
No registered users viewing this thread.

Would You Rather #9

  • Start a forum in a popular but highly competitive niche

    Votes: 9 27.3%
  • Initiate a forum within a limited-known niche with zero competition

    Votes: 24 72.7%
Win this space by entering the Website of The Month Contest

Theme editor

Theme customizations

Graphic Backgrounds

Granite Backgrounds