(Updated Again) Check for duplicates in an array!
I've been looking around for this code and no one could provide it. So finally I wrote it. It checks for duplicates in an array and returns true if there are any.
AI
AI Samenvatting: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Broncode
Public Function AnyDup(NumList As Variant) As Boolean Dim a As Long, b As Long 'Start the first loop For a = LBound(NumList) To UBound(NumList) 'Start the second loop (thanks for the suggestions everyone) For b = a + 1 To UBound(NumList) 'Check if the values are the same 'if they're equal, then we found a duplicate 'tell the user and end the function If NumList(a) = NumList(b) Then AnyDup = True: Exit Function Next Next End Function Upload
Originele reacties (3)
Hersteld van de Wayback Machine