user33585: I'm new to the Arduino world and am working on a sketch to run a servo up and down with a spdt switch.
 My code is :
include #include<Servo.h>
int pos = 0;

Servo myservo;
void setup() {
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  myservo.attach(9);
}
void loop() {
  if (digitalRead(2) == HIGH && pos < 180) {
    pos++;
    servo.write(pos);
    delay(15);
  }
  if (digitalRead(3) == HIGH && pos > 0) {
    pos--;
    servo.write(pos);
    delay(15);
  }
}

When I compile I get the "unexpected primary-expression before ';' token" error with exit status 1.
What am I doing wrong???

user33548: 1) You should be using:
myservo.write(pos);

instead of
servo.write(pos);

for all of your  methods.
2) Change:
include #include<Servo.h>

to 
#include <Servo.h>

This code only verifies when it is run on certain boards*, so make sure you are using one of those boards.Good luck and welcome to the Arduino world!:)
*Verify that your board will work, I know Mega, Uno and Nano will function properly.
P.s. Here is the whole code in correct format:
#include <Servo.h>

int pos = 0;

Servo myservo;
void setup() {
 pinMode(2, INPUT);
 pinMode(3, INPUT);
 myservo.attach(9);
}
void loop() 
{
  if ( (digitalRead(2) == HIGH) && (pos < 180)) {
    pos++;
    myservo.write(pos);
    delay(15);
  }
  if ( (digitalRead(3) == HIGH) && (pos > 0)) {
    pos--;
    myservo.write(pos);
    delay(15);
  }
}


33585: <p>I'm new to the Arduino world and am working on a sketch to run a servo up and down with a spdt switch.
 My code is :</p>

<pre><code>include #include&lt;Servo.h&gt;
int pos = 0;

Servo myservo;
void setup() {
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  myservo.attach(9);
}
void loop() {
  if (digitalRead(2) == HIGH &amp;&amp; pos &lt; 180) {
    pos++;
    servo.write(pos);
    delay(15);
  }
  if (digitalRead(3) == HIGH &amp;&amp; pos &gt; 0) {
    pos--;
    servo.write(pos);
    delay(15);
  }
}
</code></pre>

<p>When I compile I get the "unexpected primary-expression before ';' token" error with exit status 1.</p>

<p>What am I doing wrong???</p>
 33548: <p><strong>1)</strong> You should be using:</p>

<pre><code>myservo.write(pos);
</code></pre>

<p>instead of</p>

<pre><code>servo.write(pos);
</code></pre>

<p>for all of your  methods.</p>

<p><strong>2)</strong> Change:</p>

<pre><code>include #include&lt;Servo.h&gt;
</code></pre>

<p>to </p>

<pre><code>#include &lt;Servo.h&gt;
</code></pre>

<p><strong>This code only verifies when it is run on certain boards*, so make sure you are using one of those boards.Good luck and welcome to the Arduino world!:)</strong></p>

<p>*Verify that your board will work, I know Mega, Uno and Nano will function properly.</p>

<p>P.s. Here is the whole code in correct format:</p>

<pre><code>#include &lt;Servo.h&gt;

int pos = 0;

Servo myservo;
void setup() {
 pinMode(2, INPUT);
 pinMode(3, INPUT);
 myservo.attach(9);
}
void loop() 
{
  if ( (digitalRead(2) == HIGH) &amp;&amp; (pos &lt; 180)) {
    pos++;
    myservo.write(pos);
    delay(15);
  }
  if ( (digitalRead(3) == HIGH) &amp;&amp; (pos &gt; 0)) {
    pos--;
    myservo.write(pos);
    delay(15);
  }
}
</code></pre>
