Ending a programme w KeyboardStroke

I have made a traffic light simulator:

int RED = 13;
int YELLOW = 12;
int GREEN = 11;
int DELAY_RED = 5000;
int DELAY_YELLOW = 2000;
int DELAY_GREEN = 5000;

void setup(){
  pinMode(RED,OUTPUT);
  pinMode(YELLOW,OUTPUT);
  pinMode(GREEN,OUTPUT);
}

void loop()
{
  digitalWrite(RED, HIGH);
  digitalWrite(YELLOW, LOW);
  digitalWrite(GREEN, LOW);

  delay(DELAY_RED);

  digitalWrite(RED, HIGH);
  digitalWrite(YELLOW, HIGH);
  digitalWrite(GREEN, LOW);

  delay(DELAY_YELLOW);

  digitalWrite(RED, LOW);
  digitalWrite(YELLOW, LOW);
  digitalWrite(GREEN, HIGH);

  delay(DELAY_GREEN);

  digitalWrite(RED, LOW);
  digitalWrite(YELLOW, HIGH);
  digitalWrite(GREEN, LOW);

  delay(DELAY_YELLOW);
}

I am using Arduino UNO R3. Now, my question is, how can I end this programme with a KeyboardStroke?
I've done some research, and I found out I don't need a loop, I need a "while" function. So, how can I stop my programme with a KeyboardStroke, and a while loop?
I was thinking of something like this:
While(1) {programme}
If KeyboardStroke(a) then While(2)
Something like that. Is that the right code? How do I change the number in the brackets (1) to (2) ?
Will the KeyboardStroke function work?
Or is there a better way to stop a programme.
So, basicaly, I want to stop a programme with a keyboard stroke, and then to turn it back on with a keyboard stroke.

"while (1)" and "while(2)" are both equivalent infinite loops, because both 1 and 2 are true.

if (Serial.available ())
{
  while (1);
}

will stop your sketch running.

AWOL:
"while (1)" and "while(2)" are both equivalent infinite loops, because both 1 and 2 are true.

if (Serial.available ())

{
  while (1);
}


will stop your sketch running.

Can you explain this to me please?
I have no idea what you're saying. What exactly will stop my programme?

What exactly will stop my programme?

The infinite loop - while(1);. Technically, it won't stop your program. What it does is prevent your program from doing anything useful. since the code is waiting for 1 to become false, which will never happen.