I guess this code would seem pretty basic to you guys so here's what Im busy with.

I found this code on the net and Im controlling the 7 segment to count up and down when you turn the potentiometer knob.Iv changed it a bit to get what I want on the display, cut down the counts to only 7 diffrent numbers aswell.All works fine but want to add in a switch to turn off the write 3 and turn on write 4 and coil a relay.

// Need it to turn off the write 3 when a switch is pushed at this point and show write 4 // Iv removed write 4 here so at this point it skips this number. // Also looking for it to strik a relay at the same time

Please work on indentation. I'm having trouble reading what the loop() does. It seems like either a function definition was missing after the loop and before the first, or there is one extra bracket in the middle.

Also, if you are reading a potentiometer, you can't really trust that it's steadily at 0 for a long period of time. It could keep switching between states P and R. Does it do anything if sensorReading was > 678? It would seem to keep the previous state, whatever it was.

You can shorten the code by wrapping the digitalWrites into a function with the 7 pins' states and the delay as parameters. That's 2 or 8 parameters, your choice.