Topic
  • 1 reply
  • Latest Post - ‏2012-07-16T22:04:36Z by brataj
optiontips.in
optiontips.in
1 Post

Pinned topic optiontips.in

‏2012-07-14T08:57:59Z |
I have a switch statement within a Do while loop, i'm wondering if it's possible for the program to save a value from one of the cases and restart checking the switch statements (this would be the loop i imagine) so that the next output would be a different case according to the value it saved from the previous case.
Updated on 2012-07-16T22:04:36Z at 2012-07-16T22:04:36Z by brataj
  • brataj
    brataj
    41 Posts

    Re: optiontips.in

    ‏2012-07-16T22:04:36Z  
    It's not entirely clear to me what you're hoping to do, but note that Java supports labelled statements which can be used to break or continue at a scope other than the immediately enclosing block:

    
    looping: 
    
    while (condition) 
    { 
    
    switch (value) 
    { 
    
    case 
    
    const: ... 
    
    continue looping; 
    } 
    }