Các quy tắc đặt tên biến và hàm

Các quy tắc đặt tên biến (được viết bởi aptech)

  1. Variable names must begin with an alphabet.
  2. The first character may be followed by a sequence of letters or digits and can also include a special character like the ‘underscore‘.
  3. 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.
  4. 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.
  5. As case-sensitivity considerations vary with programming languages it is advisable to maintain a standard way of naming variables.
  6. 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

1 Like

Cảm ơn đãa share. Mmà hình như cái này anh @ltd có làm clip rồi :blush:

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?