Pause a robot

I am trying to find a way to pause a robot using a pause button, and be able to return the robot back to what it was doing before, using either the same button or another one. Is there a program I could write or copy and paste into my robot program in my arduino board to help me do this. Any help will be appreciated.

This might work, stuck into loop() at an appropriate spot.

while(digitalRead(pauseButton))   //true if pauseButton is HIGH
{
  // do nothing
}

But that means the button needs to be kept pressed, so a toggle switch would be better. Then just flick it back to un-pause.

Thanks. XD