As we will see, conditional statement Switch works very much like the If-Else If-Else statement, with only a syntax difference. It executes an instruction based on the calculated value of a condition. The format of the Switch statement is the following:
Posts Tagged ‘conditional processing’
Conditional statement Switch
Monday, January 9th, 2017Nested If statements
Sunday, January 8th, 2017Sometimes in your programs, you will need to perform checks inside other checks. These kind of conditional processing are called nested If statements or nested If-Else statements.
In common words, nesting is the process of placing a concept inside another concept.… Read more
Conditional statement If-Else
Sunday, January 8th, 2017In addition to If, C# offers conditional statement If-Else. When I explained the If statement, I was saying that the program will execute the instructions only if the If condition is True. What if we wanted to execute a total different condition when and only when that condition is False?… Read more
Representation of True and False values
Saturday, January 7th, 2017A few lessons so far dealt with conditional processing, displaying a result when a condition is true, and another when it is false. When working with conditional processing, it is important to understand the representation of True and False values in C#.… Read more
Conditional processing
Saturday, January 7th, 2017Now that we are done with data types, we can finally start learning about doing something useful with that data. Conditional processing is one of the most basic forms of allowing your programs to perform an useful action.
As you noticed, all the programs presented so far in our lessons started the execution with the Main method, and continued subsequently with the following instructions.… Read more
Conditional (ternary) operator
Friday, January 6th, 2017Conditional operator is a bit harder to explain. It takes an expression which produces a Boolean result in order to determine which of two other expressions will be calculated and have its value returned as a result. Its sign is ?:… Read more