Author : MD TAREQ HASSAN | Updated : 2021/03/22

If

// if
if () {

} else if(){

} else {

}

switch

// switch
switch (i) {
case 0:
    CaseZero();
    break;
	
case 1:
    CaseOne();
    break;
	
default:
    CaseOthers();
    break;
}
// case <constant or constant expressions>
// case Foo foo
// case Foo foo when foo.bar > 10

// switch expression => C# 8+
var result = bank.Status switch {
	BankBranchStatus.Open => true, 
	BankBranchStatus.Closed => false, 
	BankBranchStatus.VIPCustomersOnly => isVip
};

See: Switch (C# reference)

Ternary Operator

// Conditional or Ternary Operator
var sign = (x >= 0) ? "+ve" : "-ve";