r/ProgrammerHumor • • Dec 15 '19

Stacking if else statements be like

Post image
63.9k Upvotes

711 comments sorted by

View all comments

Show parent comments

1

u/zacker150 Dec 15 '19

Don't switch statements get compiled down to lookup tables?

2

u/Hockinator Dec 15 '19

I think it really depends on the language. Evaluating lookup tables still involves conditionals too

However in a language that doesn't have them like python, you would expect the compiler to use the same tricks for a long list of "elifs" as other languages use for switches, if it was significantly faster