Tuesday, March 5, 2019

Best Practices for Naming a Variable

Hi all here i am show you how to naming a variable


  1. Choose a variable name that make sense. For example, name, age, subject makes more sense than n, a and s.
  2. Use camelCase notation (starts with lowercase letter) for naming local variables. For example, numberOfStudents, age, etc.
  3. Use PascalCase or CamelCase (starts with uppercase letter) for naming public member variables. For example, FirstName, Price, etc.
  4. Use a leading underscore (_) followed by camelCase notation for naming private member variables. For example, _bankBalance, _emailAddress, etc.
Thank you,
Arjun walmiki

No comments:

Post a Comment