Completion requirements
Read this chapter, which discusses the switch and '?' operators to write conditional statements. 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, obscure, and difficult to comprehend. Once you have read the tutorial, you will understand the similarity of the logic used for the 'if/else' statement, '?', and 'switch' statements and how they can be used alternately.
16. End of Chapter
Answer:
Yes. Any string literal can be used.
End of Chapter
This is the end of the chapter. A strong case can be made for reviewing the following subjects.
- conditional operator The conditional operator.
- switch statement Syntax of the
switch
statement. - switch statement, example Example of the switch statement.
- switch statement, flowchart Flowchart of the switch statement.
- break statement Role of the
break
statment. - switch statement, labels Using several labels per group of statements.