What is a variable in programming?

1.55K views

What is a variable in programming?

In: Other

11 Answers

Anonymous 0 Comments

A variable is a place to store information.

Think of it like a single file folder inside a filing cabinet. You label the folder so you can find whatever’s inside easily, right?

Well, when you’re writing a program, there’s gonna be information you need the program to be able to access easily, whether it’s information you build into the code, or information the end user inputs.

The computer needs a way to store that information and be able to retrieve it on demand; a variable is what we use to allow the computer to do that. They’re called “variables” because the information they store can change.

There are several different kinds of variables (integer, string, et cetera) because the program may need to store, access, and use different kinds of information (words, whole numbers, numbers with decimal places, et cetera). Each type has certain rules that tell the program what kind of data is stored in the variable, and what kinds of things the program can do with that information.

You are viewing 1 out of 11 answers, click here to view all answers.