Once you know how to do input, output, and data calculations, you’re on your way to writing real programs. But the most useful programs have behavior: the ability to respond to conditions.
Although they don’t have human judgment, computers do make simple decisions. That’s what this chapter is about. We’ll start by looking at short programs. By the end of the chapter, you’ll have the tools to write a complete game program!
You might think of a variable as a magic box or a bucket to hold data. But it can hold only so much information—information being a precious commodity. It’s not infinite.
Chapter 1 developed examples using floating-point data. This chapter uses integer data, which ...