Unsure how to fix "expected unqualified ID before else token"

`//header
//define variables and constants

 int switchState = 0;




//setup
// the setup routine runs once when you press reset:

void setup(){
  pinMode(3,OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(2,INPUT);}

void loop(){
  switchState = digitalRead(2);
  
  if(switchState == LOW);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
}

else{
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  delay (250);
 }`

Can somebody help? Gone through a few forums already but nothing works.

Syntax is a b*tch.

a7

1 Like

Thanks for that, gonna try it now :+1:

The Autoformat tool in the IDE can help you spot some errors.

And if you put the cursor in an opening brace, the closing brace will be highlighted, and vice versa, which can help your balancing act and to see what's in, or out, of a { } block.

a7

1 Like

Appreciate it :+1:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.