5.2: The 'if' statement
Please read this chapter. This chapter discusses how computer can make decisions using an if statement.
As you read this tutorial, you will understand that sometimes it is important to evaluate the value of an expression and perform a task if the value comes out to be true and another task if it is false. In particular, try the simulated program under the heading "Simulated Program" to see how a different response is presented to the user based on if a number is positive or negative.
Pay special attention to the reading under the heading "More Than One Statement per Branch" to learn how the 'else' statement is used when there is more than one choice.
Attempt this ungraded quiz.