-
-
Save thattomperson/94e19e295d16f00b0eaf to your computer and use it in GitHub Desktop.
Classic ASP Check If In Array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% | |
| 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