digital read on stat up questions

Hi there What I am trying to do is when the arduino starts up I want it to look at a state of a digital pin and choose to do one piece of code or another depending on the state of the input pin being high or low. So in other words in set up to choose to do one loop or another. But I don't want it to continuously look at the input pin just on start up.

I hope that makes sense, any help would be appreciated.

thanks Joe

void setup() {
  if (digitalRead(startupPin)) {
    while (true) {  // This loop never ends

// else it drops through and the regular loop() is called repeatedly

Or set a flag in setup and check the flag each time loop starts.

byte whichLoop = LOW;

void setup(){
whichLoop = digitalRead(inputPin);

void loop(){
if (whichLoop == LOW){

where firstLoop and secondLoop are either functions you define elsewhere in the code or they are just replaced with the blocks of code you want to run.