Selection Statements

A program is a set of statements that are written to perform a task. Statements are the instructions given to the computer to perform an action. Control statements control the flow of the program execution either by repeating or skipping the set of statements based on the result of the test condition. Control statements are categorized into four parts i.e., sequential statement, selection statement, looping statement and jump statement. The sequential statement does not contain any test condition. A condition check always gives either of the following two values: True or False. The various types of selection statements are single selection, double selection and multiple selection statement. The if statement is used to check a test condition in a program. The if-else-if ladder is used to check more than one condition. The switch statement is used to execute the statements based on more than one test condition. If control flows to the next case below the matching case, in absence of break, it is called fall-through. Switch statement is a multiple branch selection statement. It allows user to test the value of an expression against the list of integer or character. The switch case statement, also called a case statement is a multi-way branch with several choices. A switch is easier to implement than a series of if/else statements.The conditional operator operates with three operands thus it is also called ternary operator.

To Access the full content, Please Purchase