Skip to content

Instantly share code, notes, and snippets.

@thattomperson
Forked from gwobcke/checkIfInArray.asp
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save thattomperson/94e19e295d16f00b0eaf to your computer and use it in GitHub Desktop.

Select an option

Save thattomperson/94e19e295d16f00b0eaf to your computer and use it in GitHub Desktop.
Classic ASP Check If In Array
<%
Function in_array(element, arr)
in_array = False
dim i
For i=0 To Ubound(arr)
If arr(i) = element Then
in_array = True
Exit Function
End If
Next
End Function
findThis = "Apple"
fruits = Array("Banana","Apple","Orange")
If in_array(findThis, fruits) Then
Response.Write findThis & " is in the array"
Else
Response.Write findThis & " is not in the array"
End If
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment