Error where I can't find the problem for


I found a old stupid code and I tried it again. But I get a error that a can’t fix because I really think there is nothing wrong whit the code, but yeah if you guys maybe can help me?
thanks in advance

int sensorVal;
int sensorLow = 1023;
int sensorHigh = 0;
const int ledPin = 13;

void setup(){
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);
  while (millis() < 5000){
    sensorVal = analogRead(A0);
    if (sensorVal > sensorHigh){
      sensorHigh = sensorVal;
    if (sensorVal < sensorLow){
      sensorLow = sensorVal;
  digitalWrite(13, LOW);

  void loop(){
    sensorVal = analogRead(A0);
    int pitch = map(sensorVal, sensorLow, sensorHigh, 50, 4000);
    tone(8, pitch, 20);

And this is the error I get:
"Project_3_piezo_noice_:21:14: error: a function-definition is not allowed here before ‘{’ token

void loop(){


exit status 1
a function-definition is not allowed here before ‘{’ token

Dit rapport zou meer informatie bevatten met
“Uitgebreide uitvoer weergeven tijden compilatie”
optie aan in Bestand → Voorkeuren."

  digitalWrite(13, LOW);
  void loop()

Where does setup() end ?
Which function is the digitalWrite() in ?

Omg stupid '}' this stupid piece ***"ed me so many times, but it's find thank you haha

It was easy to see the problem when the code was Auto formatted in the IDE including putting each { and } alone on its own line