Beginner question- continuous LED

I am confused why this code for a blinking LED works:

void setup() {
pinMode(10, OUTPUT);
}

void loop() {
  digitalWrite(10, HIGH);
    delay(1000);               
  digitalWrite(10, LOW);  
  delay(1000);              
}

but this code for a led that’s always on does not work:

void setup() {
pinMode(10, OUTPUT);
}

void loop() {
  digitalWrite(10, HIGH);         
}

I just want to keep one pin continuously on HIGH, but for some reason it doesn’t work; the led won’t come on. I have an LED connected to pin 10 and ground with a resistor.

I figured it out, there was something wrong with the pin I thought was ground

Glad you got it figured out. Another way you could do this also would be to set the pin high once and then start a loop that does nothing. The behavior would be exactly the same but you wouldn’t be continuously setting the pin high over and over. Sort of the set it and forget it approach.