0
What help do variables offer and what do they do?
3 Answers
+ 5
âIntroduction
Variables are like containers, they allow you to store something in it. They can be called and asked "what do you have inside you".
âReal-life example
Think of a box. Box can be labelled with paper and pen. I am naming it, say, "box1".
At this point the box is empty. So we put something into it, like a book, paper, etc.
And at any point we will be able to look into our box and see what's inside it.
âProgramming
in programming also the same thing happens. you make a box named box1. and then at some point you add a value to it. This much could be wrote like this in one line.
box1 = "this is what box1 containes"
you can read it by simply writing its name:
box1
Writing its name returns the value
hope it helps
Verse Ezekiel
+ 2
Variables are like labled boxes which can be used to store any type of information in them , till the time it fits.
- 2
Variables are used for values which are repeating in your program,
For example you are writing a story and the protagonists name is "Jack" and you used it your story, but now suddenly you dont like that name and you want to change it. So you will change the name "Jack" one by one in your story.
But if you create a variable you can just change the value of the variable and wherever you used the name Jack will change.