Monday, September 24, 2018

Variable naming convention

Programming languages may have different rules for naming variables

  1. The programming language may be case sensitive.Eg. Add,ADD,add are 3 different variables.
  2. The name of the variable may be indicative of the value it holds.Eg.If you are storing sum of 3 numbers then 'sum' variable will be appropriate name.sum=10+20+30;
  3. Every variable must have a unique name in a program.
  4. Variable names must begin with an alphabet.
  5. THe first character of variable must be followed by letters,digits and can also include special characters as 'underscore'.
  6. Avoid using letter O which may be confused with 0.

No comments:

Post a Comment