Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> C#

Control Statements (คำสั่งควบคุม) ใน C#

การไหลของการควบคุมโปรแกรมระบุโดย control statements ใน C# ประกอบด้วย:

if statement

if (boolean_expression) {
    // statement(s) executes if true
}

if-else statement

if (boolean_expression) {
    // executes if true
} else {
    // executes if false
}

for loop

for (init; condition; increment) {
    statement(s);
}

while loop

while (condition) {
    statement(s);
}

do...while loop

do {
    statement(s);
} while (condition);