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
From a purist viewpoint, break arguably shouldn't be used. The point of a while loop is that you use the condition at the start of the loop to break out of it, and things can potentially get confusing if you start to flood your loop with break statements as oppose to getting the condition correct (which is a quick hack students may well be tempted to use if they can't work out how to do things the proper way!) The same goes for continue and returning in the middle of loops.
All these language features are there for a reason and yes, sometimes they're the best way of doing things. When just starting off however, the chances of you using them judiciously and properly are rare, they're more likely to be used as free "hack to get me out of jail without understanding how this thing works" cards. And that, I'd say, is a good enough reason to ban their use in basic programming courses.