force sensor control for servos

i tried the code but it must be the way i typed it because it didn't work for me.
would you have a look at the sketch i used and let me know where i went wrong, i used the sweep code this time
#include <Servo.h>

const int servoPin = 9;
const int sensorPin = 0;

int sensorValue = 0;
int position;

Servo myservo;
int pos = 0;

void setup(){
myservo.write(180);
myservo.attach(8);
pinMode(sensorPin, INPUT);
}

void loop(){

{

openClaw();
delay(2000);
closeClaw();
delay(2000);
}
}

void openClaw(){
for (pos = 180; pos>=1;pos-=1)
{
myservo.write(pos);
delay(15);
}
}

void closeClaw() {
int i;
for (i = position; i < 180; i++) {
myservo.write(180);
if(analogRead(sensorPin)>450)
break;
}
position = i;
}