expected','or','before long' error

So I try to compile this little program and get the error message and it stops
at:
long duration;

in this sketch:

#define echoPin 7 // Echo Pin
#define trigPin 8 // Trigger Pin
const int ledPin = 13 // the pin that the LED is attached to

long duration;
long distance; // Duration used to calculate distance
int lastsensorDistance = 0;

void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(ledPin, OUTPUT);
}

void loop() {

if (Serial.available() > 0) { // see if there's incoming serial data:
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);

//Calculate the distance (in cm) based on the speed of sound.
distance = duration/58.2;

if (distance <= 20 && lastsensorDistance >= 40){
digitalWrite(ledPin, HIGH);
delay (500);
digitalWrite(ledPin,LOW);

} else {
lastsensorDistance = distance;
}
}
{

const int ledPin = 13
:wink:
const int ledPin = 13;

If you use menu 'tools -> auto format', the error can easily be spotted; after auto-format, the first part of it looks like

#define echoPin 7 // Echo Pin
#define trigPin 8 // Trigger Pin
const int ledPin = 13  // the pin that the LED is attached to

                   long duration;
long distance; // Duration used to calculate distance
int lastsensorDistance = 0;

The indentation of the line with 'long duration' is an indication where is goes wrong. As indicated by LarryD, the line before it is missing the semicolon.

In future, please post code using code tags; maintains formatting, is easier to read and easier to copy. You can edit your post:
type
** **[code]** **
before the code part
type
** **[/code]** **
after the code part

Thanks Guy!