5.3: The 'switch' Statement
Please read the chapter. This chapter discusses switch statement and '?' operator to write conditional statement.
As you read this tutorial, you will learn that sometimes it is better to use a 'switch' statement when there are multiple choices to choose from. Under such conditions, an if/else structure can become very long and at times difficult to comprehend. Please read the section under the heading "Many-way Branches," and pay special attention to the syntax of the 'switch' statement.
Once you have read the entire tutorial, you will understand the similarity of the logic used for the 'if/else' statement and 'switch' statement and how they can be used alternately.
Attempt this ungraded quiz.