ELI5: Explain Like I'm 5

Constant (computer programming)

Okay, so you know how sometimes you want to remember something important, like your mommy's phone number, so you write it down on a piece of paper and put it in your pocket?

A constant in computer programming is kinda like that - it's a special little thing that the computer remembers all the time, and it never changes. It's called a "constant" because it stays the same, like a constant friend who always likes you no matter what.

So let's say you're making a video game, and you want to make sure that the color of the sky is always blue, no matter what's happening in the game. You can use a constant to tell the computer, "hey, no matter what's happening, always make the sky blue."

Or maybe you're writing a program that needs to know how many inches are in one foot. You can use a constant to say, "there are always 12 inches in one foot, no matter what."

The cool thing about constants is that they make your code more reliable, because you don't have to worry about something accidentally changing. It's like having a really dependable friend who always remembers things for you, even when you forget!
Related topics others have asked about: