6.4. Summary

This chapter presented the basics of making decisions in a program. The basic building block of computer decision making is the simple if statement. From that, I discussed the if-else and switch statements and showed when it may be appropriate to use them. I also made some comments on programming style. Even though C# doesn't care about your coding style, other people who may have to read your code do. In all cases, try to make your code as easy to read as possible.

Get Beginning C# 3.0 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.