giusto perchè così sa quale scegliere

codice:
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Form_Load()
   Dim arr() As Integer
   ReDim arr(30000) As Integer
   For l = 0 To 30000
      If l = 20000 Then
         arr(l) = l + 4
      Else
         arr(l) = l
      End If
   Next
   Debug.Print controlaCons1(arr)
   Sleep 2000
   Debug.Print controlaCons(arr)
End Sub

Function controlaCons(arr() As Integer) As Boolean
   time1 = GetTickCount
   For i = LBound(arr) + 1 To UBound(arr)
      If arr(i) - arr(i - 1) > 1 Then
         controlaCons = False
         Exit For
      Else
         controlaCons = True
      End If
   Next i
   time2 = GetTickCount
   MsgBox (time2 - time1) / 1000
End Function
Function controlaCons1(vettore() As Integer) As Boolean
   time1 = GetTickCount
   valore = vettore(0)
   For i = LBound(vettore) To UBound(vettore)
       If valore <> vettore(i) Then Exit For
       valore = valore + 1
   Next i
   If i < UBound(vettore) + 1 Then
      controlaCons1 = False
   Else
      controlaCons1 = True
   End If
   time2 = GetTickCount
   MsgBox (time2 - time1) / 1000
End Function