Your if statement contains an assignment. You probably wanted to do a comparison.