(b=1 and a=4)or (b=2 and b=4) or (b=3 and c=4) or (b=4 and d=4)
可优化为:(b=1 and a=4) or (b=3 and c=4)
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer, d As Integer
For a = 2 To 4 'skip 1
For b = 1 To 4
For c = 2 To 4 'skip 1 for not c=1
For d = 1 To 3 'skip 4
If Not (b - 2) * (c - 3) * (a - b) * (a - c) * (a - d) * (b - c) * (b - d) * (c - d) = 0 And ((b = 1 And a = 4) Or (b = 3 And c = 4)) Then MsgBox "a" & a & "b" & b & "c" & c & "d" & d
Next
Next
Next
Next
End Sub
Private Sub Command2_Click()
Dim temp As String, i As Integer
For i = 4 To 1 Step -1
temp = Choose(i, "a = 4", "b = 4", "c = 4", "d = 4")
MsgBox temp
Next
End Sub
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer, d As Integer, temp As Boolean
For a = 2 To 4 'skip 1
For b = 1 To 4
For c = 2 To 4 'skip 1 for not c=1
For d = 1 To 3 'skip 4
temp = Choose(b, a = 4, b = 4, c = 4, d = 4) 'b 's rank is temp's result
If Not (b - 2) * (c - 3) * (a - b) * (a - c) * (a - d) * (b - c) * (b - d) * (c - d) = 0 And temp = True Then MsgBox "a" & a & "b" & b & "c" & c & "d" & d
Next
Next
Next
Next
End Sub