- Constant and variable names should have a combination of letters in lowercase (a to z) or uppercase (A to Z) or digits (0 to 9) or an underscore (_). For example:
snake_case MACRO_CASE camelCase CapWords
- Create a name that makes sense. For example, vowel makes more sense than v.
- If you want to create a variable name having two words, use underscore to separate them. For example:
my_name current_salary
- Use capital letters possible to declare a constant. For example:
PI G MASS SPEED_OF_LIGHT TEMP
- Never use special symbols like !, @, #, $, %, etc.
- Don't start a variable name with a digit.
Sunday, June 7, 2020
Rules and Naming Convention for Variables and constants
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment