November 2013
Beginner
325 pages
9h 47m
English
An important idea in programming is taking different actions depending on circumstances:
Have all the billing fields in the order form been filled out? If so, enable the Submit button.
Does the player have any lives left? If so, resume the game. If not, show the picture of the grave and play the sad music.
This sort of behavior is implemented using if and else, the syntax of which is:
if (conditional) {
// Execute this code if the conditional evaluates to true
} else {
// Execute this code if the conditional evaluates to false
}
You will not create a project in this chapter. Instead, consider the code examples carefully based on what you have learned in the last two chapters.
Here is an example of ...
Read now
Unlock full access