Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - The syntax of dim x%, y% and z% x = y = z = 1' in VB is correct, but the results are all 0. Can you tell me the principle?
The syntax of dim x%, y% and z% x = y = z = 1' in VB is correct, but the results are all 0. Can you tell me the principle?
Because variables X, Y, Z, Y and Z are declared as integers with% suffix, their values must be numbers, and their initial values are all 0.

x=y=z= 1

be qualified for sth

x=((y=z)= 1)

Parentheses are logical expressions, not assignment statements, and their execution order should be

x=((0=0)= 1)

x=(True= 1)

X=(- 1= 1) 'True corresponds to the value-1.

X=False' Because X is an integer variable, it cannot be directly assigned a negative value of False, and implicit type conversion will occur.

"x = 0”False corresponds to the value 0.

Variables y and z are never assigned, so they keep their initial values of 0.

Therefore, after the statement is executed, the values of the three variables are all 0, and there will be no grammatical errors.

If you have any questions, ask them. Please choose a satisfactory answer in time. Thank you.