Dim M (2)
For I=1 To 2
M (I)=0
Next I
K=2
For I=1 To k
For j=1 To k
M (j) (I)=M + 1
Print M (k);
Next j
Next I
End Sub
CodePudding user response:
What is your desired outcome?CodePudding user response:
Interpretation of this codeCodePudding user response:
Add the surveillance of M array, and then step to analyze whyCodePudding user response:
Key point is in the array subscript I, j, k number change and corresponding array current numericalCycles are not many, the most stupid way is to manually circulation, take note of each array values
Private Sub Command1_Click ()
Dim M (2)
All members'///initializes the array, the assignment of 0
For I=1 To 2
M (I)=0
Next I
K=2
For I=1 To k
For j=1 To k
M (j) (I)=M + 1
Print M (k);
Next j
Next I
End Sub
The For loop record numerical
I=1, j=1:
M (I)=M (1)==0
M (j)=M (1) (I)=M + 1 + 1=M (1)=0 + 1==1
M (k)=M (2)==0
'///at this point M (1)=1, M (2)=0
Print M (k)=M (2)==0
I=1, j=2:
M (I)=M (1)==1
M (j)=M (2) (I)=M + 1=M (1) + 1=1 + 1==2
M (k)=M (2)==2
'///at this point M (1)=1, M (2)=2
Print M (k)=M (2)==2
I=2, j=1:
M (I)=M (2)==2
M (j)=M (1) (I)=M + 1=M (2) + 1=2 + 1==3
M (k)=M (2)==2
'///at this point M (1)=3, M (2)=2
Print M (k)=M (2)==2
I=2, j=2:
M (I)=M (2)==2
M (j)=M (2) (I)=M + 1=M (2) + 1=2 + 1==3
M (k)=M (2)==3
'///at this point M (1)=3, M (2)=3
Print M (k)=M (2)==3
The end result of 0223