coding help

I have a program of if else statements that are testing something i would like it to stop the program if a test fails than going on with the next one but as long as they pass keep going.

Thank you for any help you could give me

digital_layout_test.ino (4.53 KB)

What do you mean by "stop the program if a test fails" ?
Taking this test for example

  if(val1 == HIGH)
  {
    digitalWrite(led1, HIGH);
    digitalWrite(led2, LOW);
    delay(2000);
  }
  else 
  {
    digitalWrite(led2, HIGH);
    digitalWrite(led1, LOW);
    delay(2000);
  }

What constitutes a failure and what should happen ?

It's looking for 5 volts and if it see's it led 1 goes on saying it passed led2 saying it failed. if it fails on any test to stop testing the rest of the steps

If a test fails set a flag to indicate faulure. Then check the flag before each test. If it is set don't do the test.

I forget how would you do that it makes sense now that you said that