© Radek Vystavěl 2017

Radek Vystavěl, C# Programming for Absolute Beginners, https://doi.org/10.1007/978-1-4842-3318-4_17

17. Compound Conditions

Radek Vystavěl

(1)Ondřjov, Czech Republic

You have now some experience formulating conditions and using them to solve real problems. As to more complex problems, what you often need is to assemble your condition out of two or more partial conditions. This is what you will study in this chapter.

Yes or No

Your first use of compound conditions will be to check that the user input belongs to one of the allowed alternatives.

Task

You will write a program that checks whether the user entered either yes or no. All other inputs will be considered incorrect (see Figures 17-1 and 17-2).

Figure 17-1 Acceptable answer ...

Get C# Programming for Absolute Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.