Rudradutt Joshi wrote:Why don't you try like
>
. . . because there is only one thing worse than
break; and that is labelled
break;.
I know a lot of people will disagree with me here. You have already been given correct solutions, by Darryl Burke and Suresh Sajja.
If you want to do something in that loop, you need a flag, and this is how you can do a linear search
Remember you can have problems if you pass
null or the array contains a
null There are ways round that problem.