using goto to navigate

Hello. im trying to make a program where i have 4 programs in one. let me explain;
i have a card with 9 LED - 4 buttons - 1 speaker - 1 swich - and a potentiometer.

i want to make smaller programs, where i use the stuff on the card to controll the LED and speaker the way i want. and make games ETC. but i want to make sort of a “lobby” where i go from one program to another.

so that the card is just laying there doing nothing but a lightshow to indicate that its waiting for a button to be pressed. once i press that button, a program will start. and it will keep running untill i press that button again. then it will go back to the lobby again and wait. here i have the option to press another button to start a game/program, or i can click again to do it again.

i need help btw… cant come up with a way to do this. can someone help me?

if (digitalRead(Knapp[0]) == 1)
{goto Chapter_1;}
if (digitalRead(Knapp[1]) == 1)
{goto Chapter_2;}
if (digitalRead(Knapp[2]) == 1) Knapp is norwegian for “button”
{goto Chapter_3;}
if (digitalRead(Knapp[3]) == 1)
{goto Chapter_4;}

digitalWrite(Led[0], HIGH);
digitalWrite(Led[1], HIGH);
digitalWrite(Led[2], HIGH);
digitalWrite(Led[3], HIGH);

this code is bullshit… but it gives an idea of what im thinking about.

Don't use the word "goto" here!

i know im stuck. this is juts a really simle and clean way to write it so you can understand where im going with this.

I suggest you design each ‘game/program’ as a non-blocking function which is called repeatedly to run the game/program - similar to the way loop() is called repeatedly to run your sketch. Then define a unique number to represent each game/program and declare a global variable to record which game/program is currently selected. Write some code in loop() which reads and debounces whichever switch inputs you will use to change the game and update that global variable when a new game is selected. Then use a switch/case statement to call the function associated with the currently-selected game.

What PeterH is describing is called a 'finite state machine'. Look it up.