(August 16, 2022 at 12:38 pm)FlatAssembler Wrote: I have always thought switch-case and large else-if statements compiled into the same assembly code.
It depends on the language and how many items are in the switch statement.
Best case, the switch turns into a lookup table or map of jump instructions. Worst case they are the same. That makes switch the smart choice, as well as making the code more readable.