// Define the input and output pins
const int switchPin = 4;

const int ledPin = 2;

void setup() {
  // Set the switch pin as an input
  pinMode(switchPin, INPUT);

  // Set the LED pin as an output
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // Read the state of the switch
  int switchState = digitalRead(switchPin);

  // If the switch is turned on, turn on the LED
  if (switchState == HIGH) {
    digitalWrite(ledPin, HIGH);
  } else {
    digitalWrite(ledPin, LOW);
  }
}