You're constantly overwriting your _return variable, so it'll only return YES if the word matches the last item in the array. You need to just quit the loop once you find a match. And no, that code would not work in Java either, or any other language. No matter what language it was, you'd be overwriting the variable every time and only hanging on to the last one.

You're constantly overwriting your _return variable, so it'll only return YES if the word matches the last item in the array. You need to just quit the loop once you find a match. And no, that code would not work in Java either, or any other language. No matter what language it was, you'd be overwriting the variable every time and only hanging on to the last one.

MacRumors attracts a broad audience
of both consumers and professionals interested in
the latest technologies and products. We also boast an active community focused on
purchasing decisions and technical aspects of the iPhone, iPod, iPad, and Mac platforms.