user46934: When I try to compile the following code in Arduino ,I get the error "expected initializer before 'void'".How can I get the code to work? 
const int LED = 9;
const int BUTON = 2


void setup() {
  pinMode (LED, OUTPUT);
  pinMode (BUTON, INPUT);
}

void loop() {
  if (digitalRead(BUTON) == HIGH);
  {
    digitalWrite(LED, HIGH);
  }
  else
  {
    digitalWrite(LED, LOW);
  }
}


user33608: You are missing a semi-colon after const int BUTON = 2
Each expression should be terminated with a semi-colon.  Your code should look like this:
const int LED = 9;
const int BUTON = 2;


void setup() {
  pinMode (LED, OUTPUT);
  pinMode (BUTON, INPUT);
}

void loop() {
  if (digitalRead(BUTON) == HIGH)
  {
    digitalWrite(LED, HIGH);
  }
  else
  {
    digitalWrite(LED, LOW);
  }
}


46934: <p>When I try to compile the following code in Arduino ,I get the error "expected initializer before 'void'".How can I get the code to work? </p>

<pre><code>const int LED = 9;
const int BUTON = 2


void setup() {
  pinMode (LED, OUTPUT);
  pinMode (BUTON, INPUT);
}

void loop() {
  if (digitalRead(BUTON) == HIGH);
  {
    digitalWrite(LED, HIGH);
  }
  else
  {
    digitalWrite(LED, LOW);
  }
}
</code></pre>
 33608: <p>You are missing a semi-colon after <code>const int BUTON = 2</code></p>

<p>Each expression should be terminated with a semi-colon.  Your code should look like this:</p>

<pre><code>const int LED = 9;
const int BUTON = 2;


void setup() {
  pinMode (LED, OUTPUT);
  pinMode (BUTON, INPUT);
}

void loop() {
  if (digitalRead(BUTON) == HIGH)
  {
    digitalWrite(LED, HIGH);
  }
  else
  {
    digitalWrite(LED, LOW);
  }
}
</code></pre>
