Arduino Nano relay control with button

I am working on a project where i need to turn on a pin that is not 13 say pin 10 ( due to when the board boots up it pulses) by pushing a button. Then it will stay on until I push the button again. then pin 10 will shut off and say pin 9 will turn on and a delay will run for a set amount of time (for testing i use one second) then shut off. after this runs i need to be able to start it again by pushing the button aka restarting the loop.

Push button
Pin 10 on
Push button
Pin 10 off
Pin 9 on
delay(1000)
Pin 9 off

Restart the loop.

Thanks for the help.

Two pointers in the right direction: BlinkWithoutDelay example and state-machines.

Here is my code. It will run like it should until the one second delay is done then pin 12 just pulses every one second. any help on resetting the program to start again when the button is pushed?

// Constants:
const int SwitchPin = 4; // the pin that the switch is attached to
const int RelayPin = 13; // the pin that the relay is attached to
const int TxPin = 6;
const int Relay2 = 12;
// Variables:
int SwitchState = 0; // current state of the switch
int PreviousSwitchState = 0; // previous state of the switch
int RelayState = 0; // current state of relay pin

#include <SoftwareSerial.h>
SoftwareSerial mySerial = SoftwareSerial(255, TxPin);

void setup() {
// initialise switch pin (32) as an input:
pinMode(SwitchPin, INPUT);
pinMode(Relay2, OUTPUT);
pinMode(TxPin, OUTPUT);
digitalWrite(TxPin, HIGH);

// enable internal pullup resistor - open switch will now go high
//digitalWrite (SwitchPin, HIGH);

// initialise relay pin (42) as an output:
pinMode(RelayPin, OUTPUT);

// initialize serial communication:
Serial.begin(9600);
}
void loop() {

// read the switch pin (32):
SwitchState = digitalRead(SwitchPin);

// read the relay pin (42):
RelayState = digitalRead(RelayPin);

// compare the SwitchState to its previous state
if (SwitchState != PreviousSwitchState) {

// if the state has changed, check change direction
if (SwitchState == HIGH){

// if the current state is HIGH then the switch went from off to on
// instigate a relay state change:

if (RelayState == LOW)
digitalWrite(RelayPin, HIGH);
delay(1000);

else
delay(1000);
digitalWrite(RelayPin, LOW);

}