Some
Description
The Some() method determines whether at least one entry in the array matches SearchElement, returning True or False as appropriate.
Some() is provided as a JavaScript-style parity method and behaves the same as Includes().
Syntax
expression.Some(SearchElement, [FromIndex], [Recurse])
Parameters
- Name
SearchElement- Type
Variant- Necessity
- Required
- Description
- The value to search for.
- Name
FromIndex- Type
Long- Necessity
- Optional
- Description
- The position in this array at which to begin searching for
SearchElement; the first element to be searched is found atFromIndexfor positive values ofFromIndex, or at the array’sLengthproperty +FromIndexfor negative values ofFromIndex. Defaults to the array’sLowerBoundproperty.
- Name
Recurse- Type
Boolean- Necessity
- Optional
- Description
- If the array is jagged (an array of arrays) or multidimensional (stored internally as jagged arrays), set
RecursetoTrueto search nested arrays.
Returns
- Type
Boolean- Description
Trueif at least one matching element is found; otherwiseFalse.
Example
Public Sub SomeExample()
Dim MyArray As BetterArray
Dim result As Boolean
Set MyArray = New BetterArray
MyArray.Push "Foo", "Bar", "Fizz", "Buzz"
result = MyArray.Some("Bar")
' expected output:
' result is True
End Sub