What Are Statements, Anyway?

Where expressions are used to drive computation, statements are the main drivers for a program’s flow of execution. Simply stated, they define the actions a program takes under various circumstances.

C# supports a variety of statements that make up a taxonomy like this:

Image Expression statements allow a subset of the expressions supported by the language to appear by themselves typically because they have useful side effects besides producing a value. A few examples include various forms of assignment, the increment and decrement prefix/postfix notation, but also method invocations.

Blocks by themselves—roughly speaking, ...

Get C# 5.0 Unleashed 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.