Ton of errors i dont understand in my code.

Hello arduino people! i could use some help with some code i have written. I have built a simple arduino robot that has a simple bump switch on the front and when this is pressed it should back up and turn 90 degrees and then head forward again. i have no idea what to do with my code and i cant find any example code online. so here is my code. have a blast.

#include <Servo.h>;
#include <switch.h>;

const int RForward = 0;
const int RBackward = 180;
const int LForeward = RForward;
const int LBackward = RBackward;
const int RNuetral = 90;
const int LNuetral = 90;
switch buttonPin;
Servo leftMotor;
Servo rightMotor;

void setup()
{
leftMotor.attach (10);
rightMotor.attach (11);
buttonPin.attach (2);
}

void loop()
{
if (buttonPin == LOW);
{
leftMotor.write(LForwards);
rightMotor.write(RForewards);
}
else;
{
leftMotor.write(LBackwards);
rightMotor.write(RBackwards);
delay (1000);
leftMotor.write(LBackwards);
rightMotor.write(RForewards);
}

Ease up on the semicolons.
Use the keystrokes you save to get some CODE TAGS.

else;

what is the purpose of this line?

And } at the end of code it is also missed

And what errors?

And did your read this "How to use this forum - please read."

Ease up on the semicolons.

Specifically, here:

#include <Servo.h>;
#include <switch.h>;

No semicolons on the end of #include statements, or other preprocessor directives.

and here:

   if (buttonPin == LOW);
 else;
switch buttonPin;

switch is not a type.

  buttonPin.attach (2);

buttonPin is not a Servo instance.

   if (buttonPin == LOW);

When you get buttonPin defined correctly (const int, with a value assigned: const int buttonPin = 2;), you'll see that it is pretty obvious that 2 is not LOW.

You want, somewhere to read the STATE of the pin that the switch is attached to, and compare the state to LOW.

so could anybody modify this code to make it work? i honestly have no idea what i am doing. Thank you!

You can get it to compile yourself if you follow the advice above, and pay more attention to consistent spelling.

Making it work (you haven't said what "work" means in this instance) is also down to you.

Anybody could, including you. What would you learn if we did it for you?

Every program goes through a stage where the compiler is barfing out errors. You need to track down each one until they are all gone. It is part of the process.

You've received a lot of good clues here. Time for some debugging. Ask specific questions and you'll get good answers.

-br

i honestly have no idea what i am doing.

Have you tried -learning- from the examples provided by your IDE?

YES! it worked! cant wait to upload and try it out! THank you all!

Why do I get a feeling like there's parallel worlds that I only see bits of?