Naming Conventions

When declaring variables and functions, you must follow a couple of rules in naming their identifiers. These rules are as follows:

  • The variable or function identifier can’t be a reserved word.

  • The identifier can’t contain any blank spaces.

  • The identifier’s first character can be only a letter of the alphabet (either upper- or lowercase), a number, or an underscore.

Example

The following are valid identifier declarations:

variable1 

_function 

The following are invalid identifier declarations:

variable 1 

function 

TIP

Remember, programming constructs are case sensitive. Thus, a variable identified as VARIABLE differs from a variable identified as variable. Keep this in mind when naming your programming construct identifiers. ...

Get WAP 2.0 Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.