multiple functions of one arduino, changeable by using a button or so

I hope someone could help me out with this one,

what would be the best approach to use one arduino for more than one function, i want it to be doing relatively very different things, which i can switch between very easily, without having to upload a new software every time,

so can i have more than one main loop to which the program can go to? or should it be done in the main loop itself, to choose with an if function where to go?

thanks

There is one and only one main loop.

It is basically run as:

while(1)
{ 
  loop();
  ... do some housekeeping stuff ...
}

However, in your loop() function you can use an "if" statement (or a Switch statement) to call any number of functions you like depending on, for instance, the read of a digital pin. You could then run those within a while loop:

void loop()
{
  if(digitalRead(2)==HIGH)
  {
    setup1();
    while(1)
    {
      loop1();
    }
  } else {
    setup2();
    while(1)
    {
      loop2();
    }
  }
}

That will run setup1() followed by loop1() over and over again if digital 2 is high, or setup2() followed by a repeating loop2() if it is low.