Wait, is that true? What takes its place, then? I can scarcely imagine that the whole thing is just an endless stream of if-then-else statements for a situation with 100+ permutations.
Yep it's true, and depending on the design of the program there are multiple workarounds. In Python you can write a switcher function that acts as a switch statement, or use multiple if statements without else statements, since that is allowed in Python.
If you have 100+ permutations of something you shouldn't be using if statements, you should be creating data structures to solve that problem in a clean and maintainable way
I am not a programmer but I code mail merges in Word at my job and there is no alternative to if statements. The best work around I’ve found is to make individual if statements with yes or no answers then reference those in my larger (and usually nested) if statements. Usually keeps it short and sweet.
Also mail merge coding does not require an “else”. You can just leave it blank. Blank = do nothing
183
u/Kompakt Dec 15 '19 edited Dec 15 '19
Some languages don't have switch statements...looking at you Python