Lesson Map | Next > Ask for Input

Passing Notes

A program is a conversation, with the computer handling the questions and answers. The computer sits between you and the user. You make the computer say (print, show) something, and the computer user responds by typing on the keyboard or moving a mouse or other pointer. Then you take a look at the user's reply, and decide what to do next.

Since you don't know in advance what the user is going to reply, you have to be prepared to accept almost any kind of answer. It's like a conversation by passing notes -- put a question in an envelope for the user, pass it along, get an answer in an envelope when it comes back.

Programs use containers somewhat like envelopes for holding and juggling information. The holding containers are called variables, because their contents are variable -- you can change the note in the envelope whenever it suits your purpose, and re-use the same envelope to pass the new information along.

Variables have identifying names (like the name on an envelope), and rules about what kinds of information they can hold. Some variables are for text only, and some are just for numbers.

The best way to understand how to use variables is actually to use them. It's time to start programming!

Lesson Map | Next > Ask for Input