Variables are used to store one or more values on a computer program.

Imagine you have a box that stores 6 pieces of apple, but they are in different color, so you decide to group similar items together, and store them in boxes. This would allow you better access to each item (apple).

Now, you have three boxes, one with Red apples, one with Green apples, and another one with Yellow apples. You have to sort the right type of box to get the required item.

And finally, give a unique name to each box to make each one easer to identify.

This is how variables are working with data and here is an example :

var redApples = 2;

Follow me on Instagram

Thank you.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store