Explain variables

blog cover image
17
7.6K followers

Explain variables

Alright, imagine you have a bunch of toy boxes in your room. Each box can hold one type of toy – maybe one box for action figures, another for Legos, and so on. In the world of coding, these toy boxes are called "variables".

Now, here's the fun part: just like you can change what toys are in each box, in programming, you can change what information is stored in each variable. So, one moment your 'action_figure_box' might have a Spider-Man figure, and the next, you could swap it for a Batman figure.

And just like how you label your boxes so you know what's inside, in coding, we give each variable a name that tells us what kind of information it holds. For example, a variable named 'numberOfCats' might hold the number of cats you have, and 'favoriteColor' might hold your favorite color!

So, variables in coding are like toy boxes for information. You can store different things in them and change the contents whenever you want. And the labels on the boxes? They're there to remind you what kind of stuff you decided to store in each box! πŸ“¦βœ¨


Here's a visualization of a child happily playing in a room, surrounded by colorful boxes and filling them with toys. This scene symbolizes the concept of storing information in variables, much like organizing and storing different items in separate boxes.

Simple, no?

Ps

Do not mingle...

Login
Create Your Free Wealthy Affiliate Account Today!
icon
4-Steps to Success Class
icon
One Profit Ready Website
icon
Market Research & Analysis Tools
icon
Millionaire Mentorship
icon
Core β€œBusiness Start Up” Training

Recent Comments

28

So very simple indeed my Fleeky friend!

Appreciate the share and I hope all is well with you??

πŸ‘πŸ˜

Yep...
ty
πŸ€—

Excellent news!

πŸ€—

🌹

Good explanation, Fleeky. At least now I know the inside box are filled with contents which can varie from box to box.

Myra πŸ’œ

πŸ˜„πŸ’πŸ‘‹

As long as we are not boxed
🀭

Good explanation, Fleeky.

What I could never understand was why do they call them variables? Why not call them 'boxes' or 'containers'?

Isaiah πŸ™‚

Lol
Perhaps because content in the boxes varies

An interesting explanation Fleeky.
Thanks for that.
How did you come up with this, what happened to make you write it.
You can tell me, I shan't tell anybody else.
Bux

Lol bux.

One of the grandkids asked me... so...
coder in spe ... ready to fix the assemler codes for voyager..

Ps
The real problem is to get them there...

Ahh! yes. Talking on the phone to my son at the weekend (40 years old) he suddenly came out with a load of really interesting stuff about evolution, which I knew he knew nothing about.
It turns out my eight year old grandson had asked him and he had to learn it to show that dads really do know things.
He was pleased he'd learnt too.
Enjoy the week.
Bux

Hahaha
That is how it goes!
Real eye openers those kids...

πŸŽ‰πŸ€­πŸ§—β€β™‚οΈ

Yes, that does make it simple!
Even simple enough for me!
Thanks,
Sami

Yes... boxes..
🀭

See more comments

Login
Create Your Free Wealthy Affiliate Account Today!
icon
4-Steps to Success Class
icon
One Profit Ready Website
icon
Market Research & Analysis Tools
icon
Millionaire Mentorship
icon
Core β€œBusiness Start Up” Training