author and iconoclast
posted 9 years ago
It works fine. Professional programmers tend to have strong feelings about this question. Some think that a method should only ever have one return statement, and therefore think a break and a flag would be good here; other people see no problem with multiple returns and think the flag is just clutter. Personally, I'm in the second camp.