Identifier name rules: Difference between revisions
From Coderwiki
More actions
new: info, general rules, identifier naming conventions |
add: identifier name must not match keyword rule |
||
| Line 7: | Line 7: | ||
* The identifier can contain only numbers, letters and underscores | * The identifier can contain only numbers, letters and underscores | ||
* The identifier must not start with a number | * The identifier must not start with a number | ||
* The identifier name must not be the same as a language [[keyword]] | |||
== Identifier naming conventions == | == Identifier naming conventions == | ||
Latest revision as of 10:29, 15 August 2025
Different programming languages have different rules on how identifiers can be named.
General rules
edit edit sourceIn most programming languages, you must follow these identifier naming rules:
- The identifier cannot contain spaces
- The identifier can contain only numbers, letters and underscores
- The identifier must not start with a number
- The identifier name must not be the same as a language keyword
Identifier naming conventions
edit edit sourceWhile not rules, most programming languages have conventions you should follow.
There are also good practices to name your identifier as clearly as possible.