Using if statements to switch between code

So I'm doing a project where I need to combine several different sketches into one.
I have 12 different buttons that I want to set to the different sketches to switch "mode"
(i.e. button 1 = follow me mode, button 2 = remote mode, button 3 = still mode)

So I'm thinking of using an if statement to switch between them.
im not sure on exactly how to use it but like this-

if (button1 == HIGH) then val=1
if (clearbut == HIGH) then val=0

[^ something so the button is always active unless cleared]

if (val == 1) do void followme()
the follow me void here

if (val == 2) do void remotemode()

etc.

I would use functions but I cant put functions inside of functions for what I know

I can try to upload the codes but there's a lot of text on it

You came very close to answering your own question here: :wink:

Harrypph:
to switch "mode"

Have a look at switch...case which is sort of like a bunch of ifs on steroids for exactly your purpose.

Harrypph:
I would use functions but I cant put functions inside of functions for what I know

You can not declare / define functions inside other functions. But you can put calls to functions inside other functions.

If you think about it, you call functions from within other functions all the time. loop() is a function, setup() is a function, pinMode(), digitalRead() and digitalWrite() are functions, etc. And you do call e.g. pinMode() from in setup() digitalRead() in loop().

void loop()
{
  if(digitalRead(button1)==LOW)
  {
    // call a function
    blinkIt();
  }
}

void blinkIt()
{
  ...
  ...
}

You cannot put a function inside a function in ANSI C true, but in GCC you can. Google nested functions.

When is your homework assignment due?