const int PinLed = 8;     // define constant PinLed
const int PinBut = 9;     // define pin for a button

void setup() {
  Serial.begin(115200);         // initialize the print interface
  pinMode (PinLed, OUTPUT);     // configure pin
  pinMode (PinBut, INPUT_PULLUP); // configure input w/in internal pullup resistor
}

void loop() {
  if (LOW == digitalRead (PinBut))  // check if button pressed, grounding pin
    digitalWrite (PinLed, HIGH);    // turn on

  else          // otherwise execute this block of code
    digitalWrite (PinLed, LOW);   // turn off
}