Adding a button

Hey Guys, I've just started using Arduino and I need help adding a button to this code, so that when the button is pressed it turns 180 degrees, then rotates back and waits for another button press.

 /* Sweep
 by BARRAGAN <http://barraganstudio.com>
 This example code is in the public domain.

 modified 8 Nov 2013
 by Scott Fitzgerald
 http://www.arduino.cc/en/Tutorial/Sweep
*/

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(30);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(30);                       // waits 15ms for the servo to reach the position
  }
}

It would be much appreciated

To learn how to use a button, there are dozens of examples in this forum and in the examples of the installed IDE.
Start with debouncing a button and have a LED switched on/off by pressing a button, so you learn how to trigger an event.

After that have a look at examples of a state machine - maybe a bit too much for your project - but it's worth to learn that, so you have that knowledge for future, bigger projects.

best to keep this all on one thread and not have two threads going. once you fix the problem with your code compiling, the next step is to merge the two.