1.

Explain the syntax and use of switch Statement with suitable example

Answer»

In computer programming languages, a switch statement is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via search and map.

switch( expression )
{
    case value-1:
            Block-1;
            Break;
    case value-2:
            Block-2;
            Break;
    case value-n:
            Block-n;
            Break;
    default:
            Block-1;
            Break;
}
Statement-x;



Discussion

No Comment Found

Related InterviewSolutions