[SOLVED] int not declared in the scope

hey guys and gals
this is my problem.
for some reason it keeps coming up with “lightval not declared in this scope”. i have no idea why. can someone please tell my what i am missing
this is the part giving me problems

void sunset() {
do{
delay(50);
int lightval = analogRead(1);
} while (lightval > 60)

for (int brightness = 255; brightness >= 0; brightness–) {
analogWrite(9, brightness);
delay(3500);
}
}

and this is the full code

#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 RTC;

  int amhour = 11;
  int ammin = 0;
  int amsec = 0;
  int pmhour = 21;
  int pmmin = 15;
  int pmsec = 0;
  int brightness;

void setup () {
  Serial.begin(57600);
  Wire.begin();
  RTC.begin();
  
  pinMode(9, OUTPUT);
  
  DateTime now = RTC.now();
  
  int hourval = now.hour();
  int minval = now.minute();
  int secval = now.second();
  
  
  on();
  
  if (hourval >= 12 && hourval <= 20) {
    analogWrite(9, 255);
  }
  
  else analogWrite(9, 0);
  
  if (! RTC.isrunning()) {
  Serial.println("RTC is NOT running!");
  RTC.adjust(DateTime(__DATE__, __TIME__));
  
  }
}

void loop() {
  DateTime now = RTC.now();
  
  int hourval = now.hour();
  int minval = now.minute();
  int secval = now.second();
  
  
  if (secval == amsec && minval == ammin && hourval == amhour) {
   sunrise(); 
  }
  
  if (secval == pmsec && minval == pmmin && hourval == pmhour) {
   sunset(); 
  }

  Serial.print(hourval);
  Serial.print(':');
  Serial.print(minval);
  Serial.print(':');
  Serial.print(secval);
  Serial.println();
  
  delay(1000);
  
}

void sunrise() {
  
 for (int brightness = 0; brightness <= 255; brightness++) {
   analogWrite(9, brightness);
   delay(3500);
 }
}

void sunset() {
  do{
    delay(50);
    int lightval = analogRead(1);
  } while (lightval > 60)
  
  for (int brightness = 255; brightness >= 0; brightness--) {
   analogWrite(9, brightness);
   delay(3500);
 }
}

void on() {
  for (int on = 0; on <= 255; on++)
  {
   analogWrite(9, on);
   delay(5);
 }
 
 for (int off = 255; off >= 0; off--)
 {
   analogWrite(9, off);
   delay(5);
 }
}

Time to read up on scope.

  do{
    delay(50);
    int lightval = analogRead(1);
  } while (lightval > 60)

The scope for lightval ends when the do/while statement ends. If you want to use lightval after that, it must not be local to the do/while loop.

ok i got it now..... thanks for your help