I\'m doing a project with basic Java for a CS class. The project has a for loop nested inside a while loop.
I am not allowed to use break as a wa
First of all, it's not a bad style to use break, if you use it judiciously.
Although I understand why your professor insists on coding without break for now (because so many people, especially beginners, tend to 'overuse' it), there's no reason to ban it completely.
Is it bad style to use return as a way to break the loop?
Personally, I think you'll be fine: code will get only simpler. But obviously your professor is the higher authority here. The whole question is very subjective, thus I can't tell for him.
But again, regardless of what your professor sais, using return in a loop is not a bad style.