Thread: break statement not within loop or switch

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    4

    Question break statement not within loop or switch

    i've been around this compiler error, but can't figure out what's wrong with it:

    Code:
    main()
    
    {
     ....
    
     if (v_type != 'y' && v_type != 'Y')
          break;
    
     ....
    }
    I always get the same error!
    Is it the syntax?

    Cheers,
    Arr

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    Show more code (surrounding that statement at least) and also tell us what the error is... don't make us guess.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    4

    Thumbs down

    sorry....my mistake! just put 1st bracket in wrong place.

  4. #4
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    change your break; to return <some number>. . . or, re-read post #2

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Break statement issues, how to return to start of loop?
    By brdiger31 in forum C++ Programming
    Replies: 3
    Last Post: 06-01-2007, 03:29 PM
  2. Replies: 27
    Last Post: 10-11-2006, 04:27 AM
  3. Base converter libary
    By cdonlan in forum C++ Programming
    Replies: 22
    Last Post: 05-15-2005, 01:11 AM
  4. Replies: 7
    Last Post: 08-06-2004, 09:14 AM
  5. Switch statement
    By big146 in forum C++ Programming
    Replies: 7
    Last Post: 06-25-2004, 07:16 AM