#1
  1. pogremar
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2003
    Location
    At Work
    Posts
    958
    Rep Power
    13

    while loops question


    I'm pretty sure I know the answer to this but gonna ask the question cause my program is acting funny. If I have to nested loops:

    while(true){

    while(true){

    break;

    }


    }



    when the break statement is encountered, does the inner loop breaks and goes back to the outer loop or will the outer loop break too?
    Some day I'll create a smart quote to put here.
  2. #2
  3. No Profile Picture
    status unknown
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    262
    Rep Power
    12
    A break only breaks from the innermost containing loop, so it will continue to execute the outer loop.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    21
    Rep Power
    0
    agree with BigBadBob
  6. #4
  7. pogremar
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2003
    Location
    At Work
    Posts
    958
    Rep Power
    13
    I know. Just, my program is acting really funny. I guess is something else.
  8. #5
  9. Bad Andy
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    OH
    Posts
    275
    Rep Power
    12
    care to be more specific?
  10. #6
  11. pogremar
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2003
    Location
    At Work
    Posts
    958
    Rep Power
    13
    It's cool. The loops are just getting more complex. I'm gonna put the program down for a couple of days and then come back to it.

IMN logo majestic logo threadwatch logo seochat tools logo