3 ms·
In a switch you see the index as a number in the case statement, above a small number, finding the value of choice is going to be unreadable, no? You have to c
by teknopaul 4y ago
In a switch you see the index as a number in the case statement, above a small number, finding the value of choice is going to be unreadable, no?
You have to count the position of the function you want?
- boffinAudio 4y agoSmall number? I think you mean properly documented enum. ;) But yeah, point taken. Its a style thing. I've just gotten allergic to wading through multiple-1000 lines of switch/case statements while trying to keep the state machine 'intentions' in my head, comparing with 'actuality' in the debugger. I much prefer the smaller lines-of-code approach, even if it has been pointed out to me now by others in this thread that switch() is faster - maintenance is a performance index, also... especially when going back to code that was written some time >1year ago, etc.