ELI5: Explain Like I'm 5

Declaration (computer programming)

When we make a computer program, we need to tell the computer what kind of things we'll be working with. Just like when we play with little toy cars, we need to know that they're cars and we can drive them around. So when we start our program, we make a list of all the things we'll be working with, and what kind of things they are.

This list is called a "declaration". It's like making a plan for what we'll need in our program. We list all the things we'll need, like numbers, words, or even things like images or sounds. We also tell the computer what we'll call these things, like "score" for keeping track of points in a game, or "name" for keeping track of a person's name.

Once we've made our declaration, we can use these things in our program just like we planned. It's like having all our toy cars lined up and ready to play with. We can pick them up and move them around just the way we want, because we know exactly what they are and what we'll use them for.
Related topics others have asked about: