+ 1

What are variables?

So I asked the same question before, and someone answered it, but it didn't answer my question very well, so I'll ask in more detail. Variables are for storing value and stuff, but why do you need to store value, and just what IS value in coding? I dont understand it at freaking all. It makes no sense to me. If you're is gonna answer this question, please answer it in great detail. Please.

30th May 2017, 3:57 PM
TGM Productions
6 Answers
+ 16
in reference to variables and replying to comments @TGM Productions you would reply to a comment by pressing the Plus in the floating icon at the bottom right corner of the page. when you press it a keyboard and text field will pop up.Now if you look at the top of this reply you'll see how I typed in this symbol " @ ". Then just type in the name are you see it at the bottom of the comment. Now the word variable and the way that the word variable is typed out with it's assignment operator, which looks like an equal sign but, isn't. This is kind of taking nomenclature from algebra. It looks like algebraic notation or scientific notation but, has nothing to do with algebra whatsoever. the just borrowed the notation deal So a variable in computer science is just a place for you to be able to type in some information to use now or to hold for later. Just imagine you were doing that test in grade school and there was no algebra just simple arithmetic word problems and it said if Jane had two apples and she gave one to John how many apples would she have left. now what if she gave two apples to John. now see how we had imagined that there were a number of apples now imagine you are looking at the chalkboard with the word problem on it and there is a box for each number but the chalkboard isn't big enough to hold another problem. Now imagine the teacher was going to show you another word problem, he would have to erase the numbers in the boxes and change the numbers. Now that is the idea of how variable work just a box to put the number in that you can use now or save later or change whatever you need to do. I'm not sure if that helps but hope it does. The way it is on the computer, just a place to store the information and it can be changed and used to solve another problem as well as changed back to solve another said a problem as the first one and that's why it's called variable
31st May 2017, 9:28 PM
Shawn Gillis
Shawn Gillis - avatar
+ 2
Values are just the data you want to store and use. Maybe a username. Player score. a speed for movement in a game. anything you need to know to use later Variables make values re-usable and easily changable. Say you have a program that needs to know the users name and uses it in a few places. you wouldn't code it like this print("My name is Justin") print("People call me Justin") If you change users would you go thru the entire code and re-write the name in each place? that wouldn't work, but this name="Justin" print("My name is " + name) print("People call me " + name) using a name variable, you can simply change the variable and it changes everyplace to variable is used inside the code. even better than coding it for each individual user. you could assign the name variable to a name the user inputs when the program starts. Then the variable would put the name, or value you assign it anywhere you code the variable to be
30th May 2017, 4:17 PM
LordHill
LordHill - avatar
+ 1
I wish I could reply to your comments. Im sorry but I still have no idea what you guys are taking about. : ( Also, I don't know algebra, so that doesn't help either. Thank you guys fur trying to help me, but I still don't understand. Sorry. :' (
30th May 2017, 4:33 PM
TGM Productions
+ 1
See if this helps. Maybe seeing them in action will help it click https://code.sololearn.com/csEvgntOb97n/?ref=app
30th May 2017, 5:25 PM
LordHill
LordHill - avatar