O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introduction to Flow of Control

In the Shakespeare.cs program presented in Chapter 2, “Your First C# Program,” all statements were executed sequentially in the order they were written in the source code. This is called sequential execution. Normally, statements in a method are executed sequentially; that is, if none of the constructs, presented in this and the next chapter that are specifically designed to redirect this otherwise linear flow of events, are encountered.

A program based purely on sequential execution will, during each execution, always perform exactly the same actions; it is unable to react in response to current conditions.

But life is seldom that simple. Often, programs need to alter the flow of control in a program.

The flow ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required