Stop looping when the index is found.