Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What is the difference between dim a and dim i in VB?
What is the difference between dim a and dim i in VB?
There is little difference, except that the data of variable type is defined as integer variable. It means defining a variable named A with an integer data type and a variable named I with an integer data type.

Dim is a statement in VB that declares variables and allocates storage space. Format: Dim variable name as data type.

Data types include:

1, integer: variables are stored in the form of 16 bits (2 bytes);

2. String: variable-length and fixed-length strings;

3.Boolean: a numerical value stored as 16 bits (2 bytes), but it can only be true or false; ;

4.Double: (double precision floating-point type) variables are stored as IEEE 64-bit (8-byte) floating-point values;

5. The 5.Long: (long integer) variable is stored as a 32-bit (4-byte) signed value.

Rules for VB to define variables

The variable 1 must be a string that starts with letters and Chinese characters, and consists of letters, Chinese characters, numbers and underscores. The last character can be a type descriptor, and there can be no spaces in the variable name;

2 Variable names cannot contain+-*/! @ # ¥ ? Decimal point and other characters, and the length can not exceed 255;

3 Reserved words (such as End, Len, Sub, etc.) cannot be used in Visual Basic. ) as a variable name, but a reserved word can be embedded in the variable name, and the variable name cannot be a reserved word with a descriptor at the end;

4 Visual Basic does not distinguish the case of letters in variable names and other names, but traditionally, symbolic constants are generally defined by capital letters.

References:

Baidu Encyclopedia: VB Variable