Comparison chart
| Python | Java | C | JavaScript | |
|---|---|---|---|---|
| First | letter, _ | lowercase letter, _, $ | letter, _ | letter, _, $ |
| Can Contain | letters, digits, _ | letters, digits, _, $ | letters, digits, _ | letters, digits, _, $ |
| Keywords not allowed for all four | ||||
| Case-sensitive for all four |
There are three things you have to look out for:
First, Java and JavaScript allows the dollar sign.
Second, digits are not allowed as the start of a variable name.
Third, Java disallows using an uppercase letter for the start of a variable name.
Dollar signs are rarely used in variable names, so we will omit them in this tutorial, and personally I think you just have to think of letters, digits, and underscores.
Then you only have to look out for two things!
First, digits are not allowed as the start of a variable name.
Second, Java disallows using an uppercase letter for the start of a variable name.
Let’s say we have a array, and we need to make a copy of it. Variable names for the copied array can look like this:
Array
ArrayCopy
Array_Copy
array
arrayCopy
array_copy
copyOfArray