LDR woes

I have more or less no idea what I'm doing, but here's my code

#include <Servo.h>

Servo myservo;
int pos = 0;
int LDR = A0;
int val = 0;

void setup() {
Serial.begin(9600);
myservo.attach(9);
pinMode(LDR, INPUT);
}

void loop() {

val = analogRead(LDR);
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
delay(1);

if (val>=10)
{
for(pos = 0; pos < 180; pos += 1)
{
myservo.write(pos);
delay(15);
}

}

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

It's compiling without error but the motor isn't turning, I don't quite know why.

Start out by marking your code, and use the code (#) tag.

You did read the How to use this forum - didn't you ?!
http://forum.arduino.cc/index.php?topic=148996.0

// Per.

Remove this line int sensorValue = analogRead(A0);

I have more or less no idea what I'm doing

I've seen some crappily indented code posted here, but, man oh man, you win the prize for the worst this year.

LOL I ain't about this life! I have no idea what's happening

codelectron:
Remove this line int sensorValue = analogRead(A0);

And that's it?

#include <Servo.h>

Servo myservo;
int pos = 0;
int LDR = A0;
int val = 0;


void setup() {                
  Serial.begin(9600);
  myservo.attach(9);
  pinMode(LDR, INPUT);
}


void loop() {
  
  val = analogRead(LDR); 
  int sensorValue = analogRead(A0);
  Serial.println(sensorValue);
  delay(1);
  
  if (val>=10)
  {
      for(pos = 0; pos < 180; pos += 1) 
     {                                 
       myservo.write(pos);              
       delay(15);                       
     } 
                
  }
    
  else 
  {
      for(pos = 180; pos > 0; pos -= 1)   
      {                                 
       myservo.write(pos);              
       delay(15);                        
        } 
  }
}

Did you have a comment or question?