DEV Community

Discussion on: Why switch is better than if-else

Collapse
 
nektro profile image
Meghan (she/her)

I didnt get to point out but I'm glad you did in your article that the best way to format a switch statement is indented.

switch (x) {
  case 0: {
    func();
  }
  case 1: {
    func2();
  }
  ..
}