If you're starting with an unsorted array and you don't know the index where the data lives then all you can do is loop through it. The gas required to do this grows as the list does, and may become so big that the contract becomes unusable.
The obvious solution is to keep the data in a mapping by address => bool
. This gives you a constant lookup cost regardless of the number of items stored.
If the data is sorted then you have a few other options including a binary search, but it's not as clean or simple as a mapping.
One final possibility if you really need to keep the data in an unsorted array is to get the user's software to iterate the array on the client side to find the index of their address, then supply it to the contract as a parameter. Then you just have to check if the data is really at that index. However this gets fiddly if the index changes, because by the time the user's transaction gets to the contract, the data may no longer be where they found it.