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).

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

%d bloggers like this: