Chapter 3. Using Elementary Statements

This chapter deals with three concepts applicable to almost any program you write in any language: variables, decisions, and loops. It’s a safe bet that if you don’t understand these concepts, your efforts at programming are doomed.

Variables are units of memory where your program stores whatever it needs to keep track of what it’s doing. Whatever source of data a program uses, the program needs memory for receiving input, performing calculations, storing intermediate results, and sending the results into some sort of output channel. No variables, no memory, no program. It’s as simple as that.

Decisions likewise are a critical component of every program. A program with no capability to compare values and ...

Get Faster Smarter Beginning Programming 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.