Arduino Programming Problem

I am trying to program two actuators using an X and Y analog joystick. Everything compiles when i cut out either top (actuator1) or bottom (actuator2) section in the void loop! What am i doing wrong, so it compiles?

const int feedback = A0; //potentiometer from actuator
const int pot = A1; //pot from throttle
const int feedback2 = A2; //potentiometer from actuator
const int pot2 = A3; //pot from throttle

const int enable = 4;
const int PWMA = 3;
const int PWMB = 5;
const int enable2 = 7;
const int PWMC = 6;
const int PWMD = 9;

int actMax = 760;
int actMin = 250;//positions of actuator
int actMax2 = 760;
int actMin2 = 250;//positions of actuator

int potMin = 0;
int potMax = 1023;
int potMin2 = 0;
int potMax2 = 1023;

int precision = 2;//how close to final value to get
int checkingInterval = 50;//how often position is checked (milliseconds)
int precision2 = 2;//how close to final value to get
int checkingInterval2 = 50;//how often position is checked (milliseconds)

int rawcurrentPosition = 0;
int currentPosition = 0;
int rawdestination = 0;
int destination = 0;
int difference = 0;//values for knowing location
int rawcurrentPosition2 = 0;
int currentPosition2 = 0;
int rawdestination2 = 0;
int destination2 = 0;
int difference2 = 0;//values for knowing location
void setup()
{
 pinMode(feedback, INPUT);//feedback from actuator
 pinMode(pot, INPUT);//feedback from potentiometer
 pinMode(feedback2, INPUT);//feedback from actuator
 pinMode(pot2, INPUT);//feedback from potentiometer
 pinMode(enable, OUTPUT);
 pinMode(PWMA, OUTPUT);
 pinMode(PWMB, OUTPUT);//three pins for MegaMoto
 pinMode(enable2, OUTPUT);
 pinMode(PWMC, OUTPUT);
 pinMode(PWMD, OUTPUT);//three pins for MegaMoto
 digitalWrite(enable,HIGH);
 digitalWrite(enable2,HIGH);
 Serial.begin(9600);
}

void loop()   //--------------------------------------------------------------------------------------------------------
{   
   destination = getDestination(); 
   currentPosition = analogRead(feedback);//check where you are
   Serial.print("Position    ");
   Serial.println(analogRead(feedback));
   difference = destination - currentPosition;//find out how far you are from the destination
   if (currentPosition > destination) pullActuatorUntilStop(destination);// choose what action to take
   else if (currentPosition < destination) pushActuatorUntilStop(destination);
   else if (difference < precision && difference > -precision) stopActuator();
}//end void loop

int getDestination()
{
   rawdestination = analogRead(pot);//read the potentiometer to get the destination
   destination = map(rawdestination, potMin,potMax,actMin,actMax);//convert the potentiometer feedback to match the actuator
   return(destination);
}//end getDestination

void pushActuatorUntilStop(int destination)
{
 destination = getDestination();
 int temp = analogRead(feedback); 
 difference = destination - temp;//check difference to see if continue moving, or stop

 while (difference > precision || difference < -precision)
 {
   destination = getDestination();
   temp = analogRead(feedback); //continue checking difference
   difference = destination - temp;
   pushActuator();
 }//end while
 
 delay(25);
 stopActuator();
}//end pushActuatorUntilStop

void pullActuatorUntilStop(int destination)
{
 destination = getDestination();
 int temp = analogRead(feedback); //check difference to see if continue moving, or stop
 difference = destination - temp;

 while (difference > precision || difference < -precision)
 {
   destination = getDestination();
   temp = analogRead(feedback); //continue checking difference
   difference = destination - temp;
   pullActuator();
 }//end while
 
 delay(25);
 stopActuator();
}//end pullActuatorUntilStop

void stopActuator()
{
 analogWrite(PWMA,0);
 analogWrite(PWMB,0);
}//end stopActuator

void pushActuator()
{ 
 analogWrite(PWMB,255);
 analogWrite(PWMA,0);
}//end pushActuator

void pullActuator()
{
 analogWrite(PWMB,0);
 analogWrite(PWMA,255);
}//end pullActuator

//addon secound acuator //---------------------------------------------------------------------------------------------


{   
   destination2 = getDestination2(); 
   currentPosition2 = analogRead(feedback2);//check where you are
   Serial.print("Position2    ");
   Serial.println(analogRead(feedback2));
   difference2 = destination2 - currentPosition2;//find out how far you are from the destination
   if (currentPosition2 > destination2) pullActuatorUntilStop2(destination2);// choose what action to take
   else if (currentPosition2 < destination2) pushActuatorUntilStop2(destination2);
   else if (difference2 < precision2 && difference2 > -precision2) stopActuator2();
}//end void loop

int getDestination2()
{
   rawdestination2 = analogRead(pot2);//read the potentiometer to get the destination
   destination2 = map(rawdestination2, potMin2,potMax2,actMin2,actMax2);//convert the potentiometer feedback to match the actuator
   return(destination2);
}//end getDestination2

void pushActuatorUntilStop2(int destination2)
{
 destination2 = getDestination2();
 int temp2 = analogRead(feedback2); 
 difference2 = destination2 - temp2;//check difference to see if continue moving, or stop

 while (difference2 > precision2 || difference2 < -precision2)
 {
   destination2 = getDestination2();
   temp2 = analogRead(feedback2); //continue checking difference
   difference2 = destination2 - temp2;
   pushActuator2();
 }//end while
 
 delay(25);
 stopActuator2();
}//end pushActuatorUntilStop2

void pullActuatorUntilStop2(int destination2)
{
 destination2 = getDestination2();
 int temp2 = analogRead(feedback2); //check difference to see if continue moving, or stop
 difference2 = destination2 - temp2;

 while (difference2 > precision2 || difference2 < -precision2)
 {
   destination2 = getDestination2();
   temp2 = analogRead(feedback2); //continue checking difference
   difference2 = destination2 - temp2;
   pullActuator2();
 }//end while
 
 delay(25);
 stopActuator2();
}//end pullActuatorUntilStop2

void stopActuator2()
{
 analogWrite(PWMC,0);
 analogWrite(PWMD,0);
}//end stopActuator2

void pushActuator2()
{ 
 analogWrite(PWMD,255);
 analogWrite(PWMC,0);
}//end pushActuator2

void pullActuator2()
{
 analogWrite(PWMD,0);
 analogWrite(PWMC,255);
}//end pullActuator2

Where are your code tags? Please edit your post.

What are your errors? Copy and paste your error window.

I bet the problem lies at line 131 due to the lack of a declaration for the function. I notice the comment in line 140 says "end of void loop". One one void loop() per program. Looks like a syntax error and an architecture issue.

Arduino: 1.8.2 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

sketch_aug01b:141: error: expected unqualified-id before '{' token

{

^

exit status 1
expected unqualified-id before '{' token

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

You have all the information you need to fix the program now. If you have another issue, repost the updated program and errors.

https://www.actuatorzone.com/blog/helpful-advice-tips/position-control-of-a-linear-electric-actuator-w-analog-sensor/

The link above is where i got the code from. Trying to add a secound actuator to the coding. It compiles the coding everytime independently on each actuator BUT as soon as i stitch them together is where i get the problem.

I tried different ways of stitching together but i had no sucess.