Switch+Statements

When you want to control the flow of your program's logic according to the value of a certain variable, the Switch statement is the perfect thing to use.

code format="csharp" int foobar = 2; switch (foobar) {    case 1: return 'case was equal to 1'; break; case 2: return 'case was equal to 2'; break; case 3: return 'case was equal to 3'; break; } code

This would return: "case was equal to 2."