Abstract: We learned in Chapter 9 that selection is a particularly important programming concept in all programming languages. To use selection in our C# code, we have several construct options, and the best construct option to choose will depend on the particular task the code has to perform. The different construct options for selection are the if construct, the if-else construct, the if else if construct, and the switch construct with its case label. The switch construct can use numeric or string data types, and when we use strings, it is based on a case-sensitive comparison. To help in using strings with the switch construct, we can make use of the ToUpper() or ToLower() method of the String class. We also learned that displaying data to the console could be achieved using "placeholders," {}, within the WriteLine() method.
Publication Year: 2022
Publication Date: 2022-01-01
Language: en
Type: book-chapter
Indexed In: ['crossref']
Access and Citation
AI Researcher Chatbot
Get quick answers to your questions about the article from our AI researcher chatbot