Chapter 4. Using Decision Statements

After completing this chapter, you will be able to:

  • Declare Boolean variables.

  • Use Boolean operators to create expressions whose outcome is either true or false.

  • Write if statements to make decisions based on the result of a Boolean expression.

  • Write switch statements to make more complex decisions.

In Chapter 3 you learned how to group related statements into methods. You also learned how to use parameters to pass information to a method and how to use return statements to pass information out of a method. Dividing a program into a set of discrete methods, each designed to perform a specific task or calculation, is a necessary design strategy. Many programs need to solve large and complex problems. Breaking up ...

Get Microsoft® Visual C#® 2010 Step by Step 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.