What is a Statement in C#?

In C#, statements express the actions that a program takes.

Common actions include

  • Declaring variables
  • Assigning values
  • Calling methods
  • Looping through collections
  • Branching to another block of code

crone-park (35)

The order in which statements are executed in a program is called the

  • flow of control or
  • flow of execution.

This may vary every time that a program is run, depending on how the program reacts to input that it receives at run time.

A statement consist of one of the following:

  • Single line of code that ends in a semicolon or
  • Series of single-line statements in a block

A statement block is enclosed in {} brackets and can contain nested blocks.

 

 

Have you got these templates?