Skip to content

Variables: how to explain them

img_0992-1

Variables have a value which the creator can assign, meaning they can vary from program to program depending on what is needed.

That make sense?

When I first taught variables to students I started with the very concept of something which varies.

I gave them a colour in picture and using their own pens/pencils told them to colour in the costume on the character.

We then hung the finished pictures on the wall and I asked the class how much could see in the colours of the characters outfits.

The answer was lots! So we discussed all the colours we could see, why we’d all done a different colour and how this displayed variables. The variable was the colour of the jacket.

In pseudo code it might look like this:

  • JacketColour = Green
  • JacketColour = Blue

So the variable is JacketColour because it can vary (ie change) depending on the options available (which colours are in the pot or pencil case).

 

Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Facebook
Instagram
Follow by Email