How to programme LDR sensor

How to programme LDR sensor

#include<SoftwareSerial.h>
int ldrpin = A0;
int ldrvalue = 0;
int led = 13;

void setup() {

Serial.begin(9600);

pinMode(led, OUTPUT);
}

void loop() {
ldrvalue = analogRead(ldrpin);
delay(1000);
Serial.println(ldrvalue);
if(ldrvalue <800)
{
digitalWrite(led,HIGH);
}
else
{
digitalWrite(led,LOW);
}

//delay(800);
}