All Resources

Input and Interaction

This activity introduces the idea of variables as well as the ability to have a program ask the user for input.

Using variables requires a bit more abstract thinking than the previous activities, so be prepared to spend extra time especially with younger students.


  • Introduces the idea of variables.


  • Per Student:
    computer per two students (one computer per student is better)

  • Per Class:
    computer with projector or SMART board.

Key Questions

  • Does the program in student step 1 know whether you type your name or a nonsense word? (No! It takes whatever you give it and counts the letters, even if the letters are numbers.)What happens in student step 2 if you type letters instead of numbers? (The program behaves as though the number you gave it were zero.)

What To Do


Ensure that all the computers work, and are connected to the internet.
Set up the instructor computer and projector or SMART board.  Log in to the Scratch website.



  1. Explain that you are going to make it possible to enter information during a program.
  2. On the screen or SMART Board, open a new Scratch project and select the Sensing tab.
  3. Point out the “ask_and wait” block and the “answer” block.  Explain that “answer” is a variable (its value can change, depending on what the user types in when the question is asked).
  4. Have students follow along on their own computers as you build this logic:

  1. Run the program.  Run it again with a different answer.
  2. Point out that you can use a variable anywhere you usually put a number or words.


  1. Use the “length of _” operator block to write a program where the sprite tells you how many letters are in your name.
  2. Use the “move_steps” block and a forever block to write a program where you can tell the sprite how far to move.


Other Resources

Liked this activity? Learn more about effective programming communication in collaboration with our friends from IBM.