error: a function-definition is not allowed here before '{' token

Hello, I'm trying to make the basic code for a IR car, but i keep an error.
This is the code:

#include <Servo.h>

int motorPin1 = 9;
int motorPin2 = 10;
int motorPin3 = 11;
int motorPin4 = 12;
int delayTime = 2;

const int knopV = 4;
const int knopA = 3;
const int knopL = 7;
const int knopR = 6;

int V;
int A;
int L;
int R;

Servo myservo;  

int pos = 0;    


void setup() {

  pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
  pinMode(motorPin3, OUTPUT);
  pinMode(motorPin4, OUTPUT);

  pinMode(knopV, INPUT);
  pinMode(knopA, INPUT);
  pinMode(knopL, INPUT);
  pinMode(knopR, INPUT);

  Serial.begin(9600);
  
  myservo.attach(8); 

}

void loop() {
  // aandrijving
  int motorPin1 = 9;
int motorPin2 = 10;
int motorPin3 = 11;
int motorPin4 = 12;
int delayTime = 2;

const int knopV = 4;
const int knopA = 3;

int V;
int A;

void setup() {
  pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
  pinMode(motorPin3, OUTPUT);
  pinMode(motorPin4, OUTPUT);

  pinMode(knopV, INPUT);
  pinMode(knopA, INPUT);

  Serial.begin(9600);
}

void loop() {

  V = digitalRead(knopV);
  A = digitalRead(knopA);
  L = digitalRead(knopL);
  R = digitalRead(knopR);


  if((V == LOW) && (A == LOW)){
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, LOW);
   }
  if(V == HIGH){
    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, LOW);
    delay(delayTime);
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, HIGH);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, LOW);
    delay(delayTime);
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, HIGH);
    digitalWrite(motorPin4, LOW);
    delay(delayTime);
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, HIGH);
    delay(delayTime);
   }
  if(A == HIGH){
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, HIGH);
    delay(delayTime);
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, HIGH);
    digitalWrite(motorPin4, LOW);
    delay(delayTime);
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, HIGH);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, LOW);
    delay(delayTime);
    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, LOW);
    delay(delayTime);
   }

   
  if((L == LOW) && (R == LOW)){
    myservo.write(90);
  }
  if(L == HIGH){
    myservo.write(130);                                    
  }
  if(R == HIGH){
    myservo.write(50);                                     
  } 
}

and this is the error messag:
''Arduino:1.8.12 (Windows 10), Board:"Arduino Uno"

stuur_en_aandrijving:56:14: error: a function-definition is not allowed here before '{' token

void setup() {

^

stuur_en_aandrijving:68:13: error: a function-definition is not allowed here before '{' token

void loop() {

^

stuur_en_aandrijving:137:1: error: expected '}' at end of input

}

^

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

Does anyone know what's wrong with the code? Thanks in advance.

so I was just scrolling trough it again, and I saw that I have 2 setups and loops. No clue why there are 2...
I'll see if deleting one loop and one setups solves the problem first, so don't bother looking into it yet.

djurre21:
so I was just scrolling trough it again, and I saw that I have 2 setups and loops. No clue why there are 2...
I'll see if deleting one loop and one setups solves the problem first, so don't bother looking into it yet.

The 2 setups and loops were the problem. oops :o