Servo with Bumper Switch

Hi guys! I want to be able to control a servo using a bumper switch, I'm kind of working with the sweep code, but I want the servo to STAY at an angle (keeping a claw open) and then close with the bumper switch, thanks!

/* 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(15);                       // 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(15);                       // waits 15ms for the servo to reach the position
  }
}

I do not understand. You have not told us how the bumper switch is wired, and you have not told us what should happen when the bumper switch opens again. Then you present code from 2013 that does something completely different.

Furthermore, you do not ask any questions. This forum works best when you properly post your code and explain what the code does versus what you desire it to do.

I give you permission to write the code that you want.