Hmmm. Here is the code I used:
I got these results:VB Code:
Option Explicit Private Declare Function GetTickCount Lib "kernel32" () As Long Private Sub Command1_Click() Dim i As Long Dim startTime As Long Dim stopTime As Long Dim timesToLoop As Long Dim time1 As Long Dim time2 As Long Dim glToGo As Long Dim bContinueLoop As Boolean Dim mcrdLastFound1 As Long Dim mcrdLastFound2 As Long Dim crd1 As Long Dim crd2 As Long mcrdLastFound1 = 9 mcrdLastFound2 = 3 crd1 = 1 crd2 = 6 bContinueLoop = True glToGo = 1 timesToLoop = 20000000 Me.MousePointer = vbArrowHourglass startTime = GetTickCount For i = 1 To timesToLoop bContinueLoop = Not (glToGo = 0 Or (mcrdLastFound1 = crd1 And mcrdLastFound2 = crd2)) Next i stopTime = GetTickCount time1 = stopTime - startTime startTime = GetTickCount For i = 1 To timesToLoop If glToGo = 0 Or (mcrdLastFound1 = crd1 And mcrdLastFound2 = crd2) Then bContinueLoop = False Next i stopTime = GetTickCount time2 = stopTime - startTime Me.MousePointer = vbArrow Text1.Text = Text1.Text & time1 & vbCrLf Text2.Text = Text2.Text & time2 & vbCrLf End Sub
First Way:
3359
3437
3359
3422
Second Way:
3094
3094
3172
3109
But if I set glToGo = 0 then I get these results:
First Way:
3203
3343
3125
3125
Second Way:
4047
3860
3875
3891
It must have something to do with the Or's




Reply With Quote