details of switch case statement
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.
Syntax
Example
Flow Chart
Example Program:- (Editor)
Editor is Loading...
Advertisement
Tags:
switch case statement in allinworld99, switch in javascript, case statement in javascript,switch and case in allinworld99 javascript.
Syntax
switch(expression)
{
case condition_variable-1:
statements;
break;
case condition_variable-2:
statements;
break;
case condition_variable-3:
statements;
break;
--------------
--------------
--------------
case condition_variable-n:
statements;
break;
default:
statements;
}
Example
a=3;
switch(a)
case 1:
{
alert("One");
break;
case 2:
alert("Two");
break;
case 3:
alert("Three");
break;
default:
alert("no condition matched");
}
Flow Chart
Example Program:- (Editor)
Editor is Loading...
Advertisement
Tags:
switch case statement in allinworld99, switch in javascript, case statement in javascript,switch and case in allinworld99 javascript.
Nhận xét
Đăng nhận xét