Các quy tắc đặt tên biến (được viết bởi aptech)
- Variable names must begin with an alphabet.
- The first character may be followed by a sequence of letters or digits and can also include a special character like the ‘underscore‘.
- Avoid using the letter O in places where it can be confused with the number 0 and similarly the lowercase letter L can be mistaken for the number 1.
- Proper names should be avoided while naming variables. Typically, uppercase and lowercase letters are treated as different i.e. variables ADD, add Add are all different.
- As case-sensitivity considerations vary with programming languages it is advisable to maintain a standard way of naming variables.
- A variable name should be meaningful and descriptive; it should describe the kind of data it holds. For example, if the sum of two numbers is to be found, the variable storing the result may be called sum. Naming it s or ab12 is not a good idea
Mem nào có them quy tăc nào thì bổ sung nha