Here is your code Auto formatted in the IDE and posted here in code tags as advised in How to get the best out of this forum
void setup()
{
pinMode(12, OUTPUT);
pinMode(2, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(8, OUTPUT);
pinMode(6, OUTPUT);
pinMode(11, OUTPUT);
}
void loop()
{
delay(200);
digitalWrite(6, HIGH);
if (digitalRead(10) == LOW)
{
exit(0);
}
else if (digitalRead(10) == HIGH)
{
if (digitalRead(2) == LOW)
{
digitalWrite(12, HIGH);
}
if (digitalRead(2) == LOW)
{
exit(0);
}
else if (digitalRead(2) == HIGH)
{
if (digitalRead(10) == LOW)
{
digitalWrite(8, HIGH);
}
}
}
}
Note how much easier to read and follow than your version of the same code
My first suggestion would be to make the code even more readable by giving pins meaningful names rather than using anonymous pin numbers throughout the code