2 ms·
The example shouldn’t be compared to esleif, that’s not how switches work. Also, because it throws you can just use if, without a block. Or use if at the end o
by jbverschoor 6y ago
The example shouldn’t be compared to esleif, that’s not how switches work.
Also, because it throws you can just use if, without a block. Or use if at the end of the line if your language supports that.
Way cleaner (less indentation), and less error prone. Switch statements only exist because of the underlying assembly/opcode.
It just as bad as goto, because it IS goto. The cases are goto-labels. It behaves like goto, and will simply generate the same JE/JNE jumps