Tutorial by Examples

Programming in general often requires a decision or a branch within the code to account for how the code operates under different inputs or conditions. Within the C# programming language (and most programming languages for this matter), the simplest and sometimes the most useful way of creating a br...
Following on from the If-Else Statement example, it is now time to introduce the Else If statement. The Else If statement follows directly after the If statement in the If-Else If-Else structure, but intrinsically has has a similar syntax as the If statement. It is used to add more branches to the c...
A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case. A switch statement is often more concise and understandable than if...else if... else.. statements when testing m...
The following statement if (conditionA && conditionB && conditionC) //... is exactly equivalent to bool conditions = conditionA && conditionB && conditionC; if (conditions) // ... in other words, the conditions inside the "if" statement just form an...

Page 1 of 1