Chapter 2. Remember This—Memory and Variables

What is a program? Hey, wait a minute, I thought we answered that in chapter 1! We said a program was a series of instructions to the computer.

Well, that’s true. But almost all programs that do anything useful or fun have some other qualities:

  • They get input.
  • They process the input.
  • They produce output.

Input, processing, output

Your first program (listing 1.1) didn’t have any input or processing. That’s one reason why it wasn’t very interesting. The output was the messages the program printed on the screen.

Your second program, the number-guessing game (listing 1.2), had all three of the basic elements:

  • The input was the guesses the player typed in.
  • The processing was the program checking ...

Get Hello World! now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.