1.12. Jump Statements
Some of the loops and flow of control structures we have discussed will exit automatically when a condition is met (or not met), and some of them will not. The C# language defines a number of jump statements that are used to redirect program execution to another statement elsewhere in the code. The two types of jump statements that we will discuss in this section are the break and continue statements. Another jump statement, the return statement, is used to exit a method. We will defer our discussion of the return statement until Chapter 4.
You have already seen break statements in action earlier in this chapter, when they were used in conjunction with a switch statement. A break statement can also be used to abruptly terminate ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access