Variable-Naming Conventions

When declaring variables, you should be aware of a few naming conventions:

     

  • A variable’s name must begin with a letter or an underscore character, followed by more letters or digits.
  • It can’t contain embedded periods or other special punctuation symbols. The only special character that can appear in a variable’s name is the underscore character.
  • It mustn’t exceed 1,024 characters.
  • It must be unique within its scope. This means that you can’t have two identically named variables in the same subroutine, but you can have a variable named counter in many different subroutines.

Variable names are not case sensitive: myAge, myage, and MYAGE all refer to the same variable in your code. Actually, as you enter variable names in your code, the editor converts their casing so that they match their declaration.