Ask coding questions

← Back to all posts
What is a variable?
SixBeeps (5037)

Hello,
I am working on some of my Computer Science homework, and we're on the Variables unit. But, I am having a hard time understanding what a "variable" actually is. Can someone help me with this?

Answered by MrEconomical (2287) [earned 5 cycles]
View Answer
Comments
hotnewtop
MrEconomical (2287)

if you mark this comment as the answer, you shall be forever blessed.

SixBeeps (5037)

@MrEconomical It has been exactly 11 months, so here ya go.

Roar123 (447)

variable = variable

DynamicSquid (4621)

Ah, you actually got me there...

I thought you were going crazy for a second

DynamicSquid (4621)

@SixBeeps At first I looked at your question and was like "come on, what kinda question is this?", then I looked at your username and was like "hold up..."

[deleted]

He’s not crazy. Sometimes people know what it is, but can’t explain. For instance, take the definition of “know”. You would say, “I know what it means, but I can’t say it in words.” It’s kind of like that. @DynamicSquid

DynamicSquid (4621)

@CodeABC123 True, but I was referring more to the person asking the question. Like @SixBeeps asking this question?

[deleted]

I know, I also thought he was going crazy for a second too, but I thought carefully. And some of the best coders are not the best explainers, like me. I’m good at coding, but I have a hard time explaining why I didn’t do my homework. @DynamicSquid

DeaconBurgess (77)

A variable can be a lot of thing like a bool describes true or false variables are data values that can changes when the user is asked a queston - GOOGLE DEFINITION <<<<<<<<<<<<<------------!!!!!!!!!!!!!!!!!!!!!!!!!

dillonjoshua68 (73)

What grade u in....
I’m currently going to year 11 (Gonna have IGCSE ‘s at the end of the year)

SixBeeps (5037)

@dillonjoshua68 I'm going to be a freshman in college

dillonjoshua68 (73)

Ohhh ok, so u must’ve finished ur A-levels recently? @SixBeeps

SixBeeps (5037)

@dillonjoshua68 I'm in the US, so we don't have them :)

dillonjoshua68 (73)

Oh ok :) .. I’m in UAE, in a British curriculum school... so yah... I will be having them in the future @SixBeeps

SixBeeps (5037)

@dillonjoshua68 Ah I see. Good luck with them ^^

Coder100 (16759)

A variable can be thought of as a "storage container". For some languages, this storage container has a specific to what is allowed and what isn't, such as C#. To other languages, this is undetermined, such as JavaScript.

Also, nice joke!

MesyetiIsTaken (56)

It's like a file containing information, but very small and 8nky on 1 line, for more than 1 line it's a list

SixBeeps (5037)

@MesyetiIsTaken
Look at when my original post was created

FlaminHotValdez (430)

@SixBeeps Good April Fools joke. Not falling for it.

GaneshaSharma (47)

I'm assuming it's python.

A variable is to store data like:

hi = "Hi," 
name = input("What is your name?\n")
print(hi, name + "!")

You can use it for input, numbers, strings (text), and all sorts of things!

SixBeeps (5037)

@GaneshaSharma Look at the date/time this was posted

CodeLongAndPros (1596)

A variable is a location in memory where your data is stored. The variable is a pointer to the address where the var is stored. Ex: 0x7c00, 0xFFFFF

Baconman321 (1050)

Think of a variable as a container, and the computer labels it. When you are ready to retrieve or modify it, the computer finds the "container" and does whatever you tell it to do.

SixBeeps (5037)

@Baconman321 Look at when this was posted

SixBeeps (5037)

@Baconman321 Then why did you respond with a legitimate answer?

Baconman321 (1050)

@SixBeeps Because yes (also for anyone viewing this question that doesn't know what a variable is).

Highwayman (1455)

@Baconman321 can I use your answer for a tutorial I’m making that will never come to fruition?

Baconman321 (1050)

@Highwayman sure, it's taken from alot of other tutorials though.

Highwayman (1455)

@Baconman321 🤷‍♂️ Thanks anyways :P

JannaYoussef (17)

A variable is a name that stores a specific value.

SixBeeps (5037)

@JannaYoussef Look at when this was posted

LiamDonohue (291)

In programming, a variable is a value that can change, depending on conditions or on information passed to the program. Typically, a program consists of instruction s that tell the computer what to do and data that the program uses when it is running.

3465728974563 (49)

Look at when this was posted and who it was posted by. @LiamDonohue