loop within a switch case

how do i do this

i want 3 'modes'

if case = 0 nothing happens if case = 1 i have buttons to edit things if case = 2 the same buttons edit different things

(its to save on buttons lol - not enough I/O pins :-[)

my switch case is working fine but to run my program properly like this like i want to do i need to loop within a case, currently the buttons only work if i keep hold of the mode button that changes the case number and that means that my cases are constantly switching and i have to press my buttons in the right time or i fail :-[

can i do this or is it a no no

You could solve thus the other way around. Do not use different loops to determine the proper action, but use the state upon detecting press to determin action.

This will lead to a slightly repetative code, but it should be easy to extend and debug.

sorry i don't follow - could you explain a little more please

thank you

if (buttonIsPressed) {
  switch (state) {
    case STANDBY: break;
    case MODE1: 
      // act according to mode1
      break;
  }
}

Tiring to write code on touchphone...