December 2015
Intermediate to advanced
416 pages
7h 15m
English
CHAPTER 4
![]()
Quiz Games and If Statements
How do we tell if a player has beaten the high score? How can we tell if he has run out of lives? How can we tell if she has the key required to open the locked door?
What we need is the if statement. The if statement is also known as a conditional statement. (You can use the term conditional statement when you want to impress everyone how smart you are.) The if statement allows a computer to make a decision. Is it hot outside? Has the spaceship reached the edge of the screen? Has too much money been withdrawn from the account? A program can test for these conditions with the if statement.
Basic Comparisons ...
Read now
Unlock full access