我正在尝试将一个整数和一个整数数组传递给一个函数,以检查该整数是否是数组的成员。箭头线给出了一个编译错误消息:“expect:=”。
Public Sub mainSub()
B = Array(4, 5, 6, 7, 8, 9)
ckArr(4,B) '<-------
End Sub
Public function ckArr(N As Integer, A() As Integer)
For i = 0 To UBound(A)
If N = A(i) And i <= UBound(A) Then
Debug.Print N; " Is in the List"
Exit For 'Do
ElseIf i < UBound(A) Then GoTo NXT
Else:
Debug.Print N; " Is NOT in the List"
Exit For 'Do
End If
NXT:
'i = i + 1
Next 'Loop
End function