Thread: break == bad

  1. #1
    Unregistered
    Guest

    break == bad

    so whats the verdict on this my c++ prof says the use of break is bad what do you think?

  2. #2
    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.

  3. #3
    Registered User blackwyvern's Avatar
    Join Date
    Jan 2002
    Posts
    60
    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.

  4. #4
    In The Light
    Join Date
    Oct 2001
    Posts
    598

    OK ill bite

    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.

  5. #5
    Registered User Paro's Avatar
    Join Date
    Feb 2002
    Posts
    160
    what does break do when its not in switch statements?
    Paro

  6. #6
    Registered User
    Join Date
    Sep 2001
    Posts
    9
    to get out of loops, pal.

  7. #7
    Registered User Paro's Avatar
    Join Date
    Feb 2002
    Posts
    160
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Number to Word (Billions)
    By myphilosofi in forum C Programming
    Replies: 34
    Last Post: 02-04-2009, 02:09 AM
  2. One quick question...
    By Kross7 in forum C++ Programming
    Replies: 10
    Last Post: 04-13-2007, 09:50 PM
  3. Keyboard Hook
    By jmd15 in forum Windows Programming
    Replies: 19
    Last Post: 08-07-2005, 03:11 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. swapping elements in a 2D array
    By axon in forum C++ Programming
    Replies: 9
    Last Post: 03-10-2003, 02:18 PM