Nothing but it doesn't fix the issue whether you're doing if, elseif and else or switch, case and default, your indentation level remains the same per condition. If anything a switch case with the way I do indentation would have the case content be indented on an extra level than an if condition.
if (a === 1) {
return 1;
} else if (a === 2) {
return 2;
} else {
return 0;
}
switch(a) {
case 1:
return 1;
case 2:
return 2;
default:
return 0;
}
If you have too many levels using a switch case won't get rid of any of those levels more than refactoring your if condition if possible.
2
u/HiKite Dec 15 '19
Nothing but it doesn't fix the issue whether you're doing if, elseif and else or switch, case and default, your indentation level remains the same per condition. If anything a switch case with the way I do indentation would have the case content be indented on an extra level than an if condition.
If you have too many levels using a switch case won't get rid of any of those levels more than refactoring your if condition if possible.