程序控制的流程由C#中的控制语句指定。它包括以下内容-
if语句由一个布尔表达式和一个或多个语句组成。
以下是语法-
if(boolean_expression) {
   /* statement(s) will execute if the boolean expression is true */
}if语句后可以跟可选的else语句,该语句在布尔表达式为false时执行。
以下是语法-
if(boolean_expression) {
   /* statement(s) will execute if the boolean expression is true */
} else {
   /* statement(s) will execute if the boolean expression is false */
}它多次执行一系列语句,并简化了管理循环变量的代码。
以下是语法-
for ( init; condition; increment ) {
   statement(s);
}当给定条件为真时,它将重复一个语句或一组语句。它在执行循环主体之前测试条件。
以下是语法-
while(condition) {
   statement(s);
}它类似于while语句,除了它在循环主体的末尾测试条件。
以下是语法-
do {
   statement(s);
} while( condition );