number == values[i]
- i have tried doing that but it gives me error "="
What is the error message?

You can break from the loop, return from the function, or base the loop condition on a flag (i.e., some boolean variable) that is set when a match is found.
- i have no idea how to do that
Read the tutorials on loops and functions.