digitalRead always returning HIGH

I have this code I wrote to test a switch I have for a project. I was trying my circuit out when I noticed that it was just leaving the on-board LED on.

I removed the board from my circuit entirely, and just have a jumper hooked up to the input pin.
Whether I hook the other end of the jumper to ground, 5V, another digital pin set to LOW, or leave it floating, it always returns a HIGH value. I've also tried pretty much every digital pin, and have tried both INPUT and INPUT_PULLUP modes.

Attached you'll find a screenshot of the serial output (which does not change no matter where the jumper is hooked up).

It's gotta be something simple I'm missing, but my debugging has resulted in nothing and so I have come here for some advice from the pros.

Thanks in advance for the assistance.

//Magnetic limit switch test code
//skinnymaniskool 2018

const int swPin = 12;
int val = 0;


void setup() {
  pinMode(swPin, INPUT_PULLUP);
  pinMode(LED_BUILTIN, OUTPUT);
  
  Serial.begin(9600);
  Serial.print("Start");
  Serial.println();
}



void loop() {
val = digitalRead(swPin);
  if (val=LOW) {
//      digitalWrite(LED_BUILTIN, val);
       Serial.print(val);
       Serial.print("HIGH");
       Serial.println();
  } else if (val=HIGH){
//      digitalWrite(LED_BUILTIN, val);
       Serial.print(val);
       Serial.print("HIGH");
       Serial.println();
  } else {
    Serial.print("Error");
  }
  delay(500);
}

 if (val=LOW) {

That is an assignment operation, not a comparison operation.

Reference for if else.

Aha! So it needed to be:

if (val==LOW){}...

Thanks! I knew it was something dumb.

If you turn on all compiler warnings you should get a warning for that.