Summary
In this chapter, you learned the many ways you can control the flow of a program in C#. The benefit of learning flow control is that it’s a common concept across a variety of languages and learning them now will help you learn to use them in different languages and platforms as well. We started by learning that conditions play an important role in flow control regarding Boolean data types. Next, we applied the if..else
statement to branch out to different lines of code based on a condition. Then, we learned how to iterate and repeat executing lines of code with for
and while
loops, and compared and contrasted the two.
Later, you learned about how methods achieve flow control by organizing multiple lines of code that focus on a particular goal or task with the added benefit of reusing code, including being able to use multiple values with parameters and their matching arguments and extracting values with the return statement. Finally, you put your flow control skills...