What are the rules for naming variables in Visual Basic? Providing examples of the good and the bad, discuss what impact good programming practice has on the naming of variables.
What will be an ideal response?
The name must begin with a letter or an underline symbol (_). The name can contain letters, numbers, or the underline symbol. It cannot contain spaces or other special characters. Reserved words in Visual Basic cannot be used for variable names; reserved words appear in blue in the code window. Good programming practice dictates that the variable names you use should reflect the actual values to be placed in the variable. That way, anyone reading the program code can easily understand the use of the variable. For example, a good variable name for a string variable that will contain an employee's last name would be strEmployeeLastName. Names you should not use include strXXX, strLN, strEmp, or strName. Each of these names is imprecise and potentially misleading. You should consider the people who will be reading your code when you name the variables in your program. Your goal must be to make the task of reading your code as clear and easy as possible.
You might also like to view...
Which of the following is true about 64-bit drivers that run in kernel mode on Windows 10?
A. can run in 32-bit Windows versions B. must be digitally signed by Microsoft C. can be used to control printers D. have limited access to the computer
A copy constructor has _________ parameters.
(a) zero (b) one (c) two (d) three