Chapter 2

Basic Program Structure

What You Will Learn in This Chapter

  • Understanding C# simple statements
  • Exploring C# complex statements
  • Using boolean expressions
  • Creating if-then-else statements
  • Using switch statements
  • Constructing for statements
  • Using foreach statements
  • Understanding while statements
  • Using do-while statements


You can find the code downloads for this chapter at on the Download Code tab. The code is in the chapter 02 download and individually named according to the names throughout the chapter.

Computer programming has certain foundational aspects that any programming language must incorporate. C# is no exception. Programming has basic concepts such as repetition structures that help you repeat certain tasks and decision structures that allow your code to execute a different branch of statements based on the outcome of comparisons. This chapter introduces you to the basics of programming in C# and covers the topics necessary for you to understand core functionality in the C# programming language so that you can successfully take the exam. These key topics enable you to learn about statements in C#, both simple and complex, and how they are used in a C# application to perform the actions necessary to complete the tasks your code is intended to perform. You will learn what statements are and how to construct them your code.

The chapter then focuses on giving you an understanding ...

Get MCSD Certification Toolkit (Exam 70-483): Programming in C# now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.