+ 1
swich statement
please explain
2 Answers
+ 1
Elegant way of if-else if-else.
Use:
switch(x) {
case 1:
...some code...
break;
case 2:
...some code...
break;
default:
...some code...
break;
}
Ä°nstead of:
if (x==1) {
...some code...
} else if (x==2) {
...some code...
} else {
...some code...
}
+ 1
thanx Erol EREN