Input and Output: Talking to the World

Input is information going into a program. Output is what the program gives back.

7 min read

A program that can't receive anything or show anything would be pretty lonely. Real programs constantly exchange information with the outside world. We have two words for this: input and output.

Input: information coming in

Input is any information that goes into a program. Examples you use every day:

  • Typing your password into a login box.
  • Tapping a button in an app.
  • Speaking to a voice assistant.
  • A thermostat reading the room temperature.

All of these are inputs — ways the program receives something to work with.

Output: information going out

Output is any information the program sends out. Examples:

  • A message appearing on your screen.
  • A sound or song playing.
  • A printed receipt.
  • A light turning on.

The classic pattern: input, process, output

A huge number of programs follow one simple shape: take some input, process it (do something with it), then produce some output.

Here's a tiny pseudo-code example that asks for a name and greets the person:

ask "What is your name?" into name
show "Hello, " + name + "!"

Reading it as steps:

  1. Input: ask the user for their name and store it in the variable name.
  2. Process: build a greeting by joining "Hello, " with the name.
  3. Output: show the greeting on the screen.

If you typed Maria, it would show: Hello, Maria!

Tip: When you imagine a program you'd like to build, ask yourself three questions: What goes in? What needs to happen? What should come out? Answering those is the first step of designing almost anything.

Quick check

Q1 Which of these is an example of input?

Q2 Many programs follow which common pattern?

Want to save your progress? It's free.

Create a free account