If statements not being run

Hello everyone I have been having this problem for a while now. When ever I try to use an if statement it doesn't execute at all. Here is an example of me trying to use a button connected to digital pin 4 to trigger the built-in led.

int inPin = 4;     
int val = 0;       

void setup()
{
  pinMode(inPin, INPUT);        
  Serial.begin(9600);
  digitalWrite(LED_BUILTIN, LOW);
}

void loop()
{
  val = digitalRead(inPin);     // read the input pin
  if (val == 1){digitalWrite(LED_BUILTIN, HIGH); Serial.println("LED active");}
      
  Serial.println(val);
}

When I run it I get an accurate update of the button's state coming through the serial port but it doesn't print "LED active" or turn the led on. Does anyone know what is going on

I ran your program here on an Arduino Uno. Here's what I see in the serial monitor when the pin 4 is at 5 volts.

However, the LED does not respond. I believe this is due to 2 problems with your code.

1: Missing pinMode(LED_BUILTIN, OUTPUT) in setup()

2: Missing digitalWrite(LED_BUILTIN, LOW) in loop()

But this doesn't explain why you're not seeing "LED active" in the serial monitor, I did here.

This code definitely does works with both:

int inPin = 4;
int val = 0;

void setup()
{
  pinMode(inPin, INPUT);
  Serial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);
}

void loop()
{
  val = digitalRead(inPin);     // read the input pin
  if (val == 1) {
    digitalWrite(LED_BUILTIN, HIGH);
    Serial.println("LED active");
  } else {
    digitalWrite(LED_BUILTIN, LOW);
  }

  Serial.println(val);
}

Maybe its a problem with my board

RandomExplosion:
Maybe its a problem with my board

No, pjrc's nailed it. Pinmode man.