- A case or 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 a multiway branch.
new.int,switchtest=23;
switch,switchtest;
case,1->console.println("switchtest is 1");
case,23->console.println("switchtest is 23");
case,2->console.println("switchtest is 2");Output:
switchtest is 23