Using IR Remote like as a with cd player

Hello everyone. I'm new to code.
How do I code in such a way that when I press the plus or minus button on the IR remote control the code goes forward or back 1 section of code then continues?

Just like with a cd player, except each song is a section of code. There are about 100 sections of code where I'd like this to apply. Each section is about 20 lines of code. Do I 'name' each section 1 to 100 somehow then say if button pressed go back 1 section? I am very lost.
Please help?

Kind regards

Perhaps switch...case would work?

Have the button increment the variable which is the label of the case?

switch (var) {
  case label1:
    // statements
    break;
  case label2:
    // statements
    break;
  default:
    // statements
    break;
}

No problem with the hardware? All is tested and working?

ThisMightBeAGoodRead

Thank you for your tip.
I only just started coding and don't understand the language yet.
Here is where I'm up to and am very stuck

I just want each section of code treated similar to a song on a cd.. So if the code is on section 3 and then I press backward button it will go to section 2 straight away and continue like normal.
Do you know where I can ask someone to help finish a code like this?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.