expected unqualified ID before if/else

Problem solved, I forgot brackets...

This problem is happening inside the red area of code, I cant figure out why. does anyone know?

#include <Servo.h>

Servo leftServo;
Servo rightServo;
int CCW = 0;
int CW = 180;
int OFF = 90;

int spinTime = 100;
int reverseTime = 200;
int startUpSpinTime = 100;

// the setup function runs once when you press reset or power the board
void setup() {
pinMode(5, OUTPUT);
pinMode(2, OUTPUT);
pinMode(10, INPUT); //Set pin 10 as in Input
pinMode(11, INPUT); //Set pin 11 as an Input
pinMode(13, OUTPUT);
rightServo.attach(9);
leftServo.attach(8);
digitalWrite(10, HIGH); //Turns ON internal pull-up on pin 10
digitalWrite(11, HIGH); //Turns ON internal pull-up on pin 11

rightServo.write(CCW);
leftServo.write(CCW);

for(int i = 1;i<=5;i++){
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(500);
}
digitalWrite(5, LOW);
rightServo.write(CW);
leftServo.write(CW);
delay(startUpSpinTime);
digitalWrite(5, HIGH);
rightServo.write(OFF);
leftServo.write(OFF);
}

// the loop function runs over and over again forever
void loop() {

while (digitalRead(10) == HIGH && digitalRead(11) == HIGH){
rightServo.write(180);
leftServo.write(0);
delay(20);
}

if (digitalRead(10) && digitalRead(11)){
int j = random(0,1);

if j = 1{
reverse();
spinRight();
}
else{
reverse();
spinLeft();
}
}

if digitalRead(10,LOW){
reverse();
spinRight();
}
else{
if digitalRead(11,LOW){
reverse();
spinLeft();
}
}
}

void reverse(){
rightServo.write(CCW);
leftServo.write(CW);
delay(reverseTime);
}

void spinRight(){
rightServo.write(CCW);
leftServo.write(CCW);
delay(spinTime);
}

void spinLeft(){
rightServo.write(CW);
leftServo.write(CW);
delay(spinTime);
}

 if (digitalRead(10) && digitalRead(11)){

if (digitalRead(10) is what?
if (digitalRead(11) is what?

if j = 1

Erm, NO! Try:

if (j ==1)

Also, you don't appear to have defined 'j'.
Please also always post your code in code tags (the "</>" above the posting window).
That way, you don't get 'smileys' in it.
Also, it's a good idea to give your pins and variables meaningful names.
10 and 11 give no indication as to what is attached to them.
What does j do?

if (digitalRead(10) )
if (digitalRead(11) )

is perfectly acceptable as long as you mean to do it and know what it means. digitalRead() returns HIGH or LOW, basically 1 or 0 which will be interpreted as true or false.

    int j = random(0,1);

Generate a random number between 0 and 0. Well, that won't take long.

UKHeliBob:

if (digitalRead(10) )

if (digitalRead(11) )



is perfectly acceptable as long as you mean to do it and know what it means. digitalRead() returns HIGH or LOW, basically 1 or 0 which will be interpreted as true or false.

Yes. I know that and you know that, but I doubt whether the OP knows that, after seeing the rest of his code.

I think you need to read up on what "while" does because if pin 10 and 11 are high what's the chances it will get past this point to where you use a "if" to see if pin 10 and 11 are high

while (digitalRead(10) == HIGH && digitalRead(11) == HIGH){
rightServo.write(180);
leftServo.write(0);
delay(20);
}

if (digitalRead(10) && digitalRead(11)){
int j = random(0,1);