Expected ")" before numeric constant

Writing a code that will look at sensor1 and sensor2 and then drive a servo motor either one direction or the reverse. The code is not finished but I check it at each stage to ensure that it is error free before continuing. I have two "IF" statements; the first one looks to see if sensor1 is HIGH and sensor2 is LOW then the servo motor turns one direction. The second "IF" statement, in my mind, should be identical, syntax wise, to the the first, just the sensors and the direction of the servo motor is reversed. I get the error "expected ')' before numeric constant". For the life of me I have stared at this until I've gotten cross-eyed and cannot see where I have gone wrong. Below is the sketch. And thank you for your help.

PS-I have tried to highlight the error but could not preview with the highlights. In case it doesn't get highlighted in lime green the error is "for(int pos = 180; pos >=1; pos--1);" 6 lines from the bottom.

// Sweep
// by BARRAGAN <http://barraganstudio.com> 
// This example code is in the public domain.

int sensor1=2;
int sensor2=3;
int sensorState1=0;
int sensorState2=0;
int lastsensorState1=0;
int lastsensorState2=0;
#include <Servo.h> 
 
Servo servo1;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
 
void setup() 
{ 
pinMode (sensor1, INPUT);
pinMode (sensor2, INPUT);

  servo1.attach(9);  // attaches the servo on pin 9 to the servo object 
} 
 void loop(){
   //Read the state of the sensor buttons;
   sensorState1=digitalRead(sensor1);
   sensorState2-digitalRead(sensor2);
   //check if the sensor1 is positive  
   //If it is, the sensorState is HIGH;
   if(sensorState1==HIGH);  
     (sensorState2==LOW); {    
      for(pos = 0; pos < 180; pos += 1);  // goes from 0 degrees to 180 degrees in steps of 1 degree
      for(int pos=0; pos<180; pos++);
    servo1.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
   if(sensorState2==HIGH);
     (sensorState1==LOW);{
    
     for(pos = 180; pos>=1; pos-=1);    // goes from 180 degrees to 0 degrees 
    [color=limegreen] for(int pos = 180; pos >=1; pos--1);[/color]
                                 
    servo1.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);  )                     // waits 15ms for the servo to reach the position 
  }
  //for next time through the loop
    {(lastsensorState1=sensorState1);
    (lastsensorState2=sensorState2);}}
[\code]

Thank you again for your help.

Just two of the many problems
if(sensorState1==HIGH);
.
.
.
for(pos = 0; pos < 180; pos += 1);

Get rid of the ; here and many other places like this.

Your format is wrong
if(sensorState2==HIGH);
(sensorState1==LOW);
Change:
If you mean AND
if(sensorState2==HIGH && sensorState1==LOW)
Or to this if you mean OR
if(sensorState2==HIGH || sensorState1==LOW)

Thank you LarryD, I was wondering what the AND/OR commands where. I've added them in. and taken out the unnecessary ';' from the 'for' statements.

Still getting the same error: "expected ')' before numeric constant"
The ')' doesn't make sense to me anywhere without the '('.

new sketch with corrections:

// Sweep
// by BARRAGAN <http://barraganstudio.com> 
// This example code is in the public domain.

int sensor1=2;
int sensor2=3;
int sensorState1=0;
int sensorState2=0;
int lastsensorState1=0;
int lastsensorState2=0;
#include <Servo.h> 
 
Servo servo1;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
 
void setup() 
{ 
pinMode (sensor1, INPUT);
pinMode (sensor2, INPUT);

  servo1.attach(9);  // attaches the servo on pin 9 to the servo object 
} 
 void loop(){
   //Read the state of the sensor buttons;
   sensorState1=digitalRead(sensor1);
   sensorState2-digitalRead(sensor2);
   //check if the sensor1 is positive  
   //If it is, the sensorState is HIGH;
   if(sensorState1==HIGH && sensorState2==LOW); {    
      for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees in steps of 1 degree
      for(int pos=0; pos<180; pos++)
    servo1.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
   if(sensorState2==HIGH && sensorState1==LOW);{
    
     for(pos = 180; pos>=1; pos-=1)    // goes from 180 degrees to 0 degrees 
     for(int pos = 180; pos >=1; pos--1)
                                 
    servo1.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);  )                     // waits 15ms for the servo to reach the position 
  }
  //for next time through the loop
    {(lastsensorState1=sensorState1);
    (lastsensorState2=sensorState2);}}
[\code]

How about the ; in your ifs
if(sensorState1==HIGH && sensorState2==LOW); {

What is this. ) ?
delay(15); ) // waits 15ms for the servo to reach the position

Memorize these :wink:

** for(int pos = 180; pos >=1; pos--1)**
you can use
pos--
OR
pos-=1
(both do the same thing but pos--1 is a syntax error)

Thank you KenF. That was my mistake. Cleared it up. It seems so obvious now. Now off to the next stage.