so whats the verdict on this my c++ prof says the use of break is bad what do you think?
so whats the verdict on this my c++ prof says the use of break is bad what do you think?
break is not bad! without break, switches would screw up, unless you return or use goto statements at the end of every case.
break has other good uses as well. If you don't you break well it is bad, of course. All commands are bad if you don't use them right. The only command that really is bad is goto. Goto can make some very unpredictible results, although BASIC programmers will disagree.
I use goto statements a lot.. I am a bad programmer =) but I was self taught and that was the easiest concept to catch onto.. I will change once I start taking some college courses on programming I suppose.
howdy,
if break is bad (i dont believe it is), what does your prof suggest using in its place, surley not goto.
maybe do/while or a series of if statments???
M.R.
what does break do when its not in switch statements?
Paro
to get out of loops, pal.
wow, that could be very helpful! seems as helpful as goto... heh why does everything that seems so easy have to be bad programming
Paro