copy/paste the servo code from examples yet it doesnt work

Hello,

ive copied the code from arduino examples ‘sweep’ and all the lines from are in the same order, however when i hit compile the first error is shown on that copied line and says 'expecte an initializer before ‘Servo’ ’ can you tell me whats an initializer and what is needed just to run the servos, nvm the rest of the code

#include <Servo.h>

Servo servo1  // korpuse
Servo servo2  // ilgoj rankoj
Servo servo3  // lempa
//const int servo1 = x;       // first servo
//const int servo2 = x;       // second servo
//const int servo3 = x;       // first servo  
int joyR = 2;        // R 
int joyL = 3;        // L
int switch1 = 4;
int switch2 = 5;
int switchUV = 6;
int pos1 = 90;  // servo1 pozicija
int pos2 = 90;  // servo2 pozicija
int pos3 = 90;  // servo3 pozicija
int white1 = 14; // viena eile baltu ledu
int white2 = 15; // antra eile baltu ledu
int UV=16;       // UV ledai
int dugnas = 17;



void setup() {
  servo1.attach(7);
  servo2.attach(8);
  servo3.attach(9);
  pinMode(white1, OUTPUT);
  pinMode(white2, OUTPUT);
  pinMode(UV, OUTPUT);
  pinMode(joyR, INPUT);
  pinMode(joyL, INPUT);
  pinMode(switch1, INPUT);
  pinMode(switch2, INPUT);
  pinMode(switchUV, INPUT);
}

void loop() 
{
  DugneUp();
  servos();
  sviesaVienas();
  sviesaDu();
  sviesaUV();
  DugneDown();

}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void sviesaVienas()                                          // ijungus pirma pozicija uzsidegs white2
{
  for (int vienasValue = 0 ; vienasValue <= 255; vienasValue += 5) // fade in from min to max in increments of 5 points:
  {
    analogWrite(white1, vienasValue);                          // sets the value (range from 0 to 255):
    delay(30);                                               // wait for 30 milliseconds to see the dimming effect
  }
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
void sviesaDu()                                              // ijungus antra pozicija uzsidegs white2
{
  for (int duValue = 0 ; duValue <= 255; duValue += 5) // fade in from min to max in increments of 5 points:
  {
    analogWrite(white2, duValue);                          // sets the value (range from 0 to 255):
    analogWrite(white1, duValue);                          // sets the value (range from 0 to 255):
    delay(30);                                               // wait for 30 milliseconds to see the dimming effect
  }
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
void sviesaUV()                                              // ijungus ijungus UV uzsidegs UV
{
  for (int uvValue = 0 ; uvValue <= 255; uvValue += 5) // fade in from min to max in increments of 5 points:
  {
    analogWrite(UV, uvValue);                          // sets the value (range from 0 to 255):
    delay(30);                                               // wait for 30 milliseconds to see the dimming effect
  }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void servos()
{
    if (joyR = 1)                               // jei joystick switchas nusuktas i desne
    { 
      if (pos1 < 180 && pos2 < 180  && pos3 > 0)      // tikrina  ju pozicija ir judina link galines
      {        
        pos1 = pos1 + 1;
        myservo1.write(pos1);                    // sets the servo position according to the scaled value
        
        pos2 = pos2 + 1;        
        myservo2.write(pos2);                   // sets the servo position according to the scaled value    
    
        pos3 = pos3 - 1;
        myservo2.write(pos3);                   // sets the servo position according to the scaled value
        delay(100);                             // waits for the servo to get there
      }
    }
    if (joyL = 1)                               // jei joystick switchas nusuktas i desne
    { 
      if (pos1 > 0 && pos2 > 0  && pos3 < 180)      // tikrina  ju pozicija ir judina link galines
      {        
        pos1 = pos1 - 1;
        myservo1.write(pos1);                    // sets the servo position according to the scaled value
        
        pos2 = pos2 - 1;        
        myservo2.write(pos2);                   // sets the servo position according to the scaled value    
    
        pos3 = pos3 + 1;
        myservo2.write(pos3);                   // sets the servo position according to the scaled value
        delay(100);                             // waits for the servo to get there
      }
    }
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void DugneUp()                                              
{
  delay(2000);
  for (int DValue = 0 ; DValue <= 255; DValue += 5) // fade in from min to max in increments of 5 points:
  {
    analogWrite(dugnas, DValue);                          // sets the value (range from 0 to 255):
    delay(100);                                               // wait for 30 milliseconds to see the dimming effect
  }
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
void DugneDown()                                              
{
  delay(2000);
  for (int DValue = 255 ; DValue >=0; DValue -= 5) // fade in from min to max in increments of 5 points:
  {
    analogWrite(dugnas, DValue);                          // sets the value (range from 0 to 255):
    delay(100);                                               // wait for 30 milliseconds to see the dimming effect
  }
}

Please and thank You

Servo servo1;  // korpuse
Servo servo2;  // ilgoj rankoj
Servo servo3;  // lempa

There are other problems with the code such as you trying to use myservo1, myservo2 and myservo3 later in the code when those servo objects have not been created.

What UKHeliBob was trying to point out is that your Servo instance statements are all missing ; at the end.

Sometimes copy and paste is like taking a paragraph from the middle of "The Nine Tailors" and pasting it in the middle of "The Night Manager" - it won't make any sense.

Re-using existing code is very sensible, but you must know enough about it to make sure the context is correct.

...R