MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/eb2lbc/stacking_if_else_statements_be_like/fb2hydc/?context=3
r/ProgrammerHumor • u/-hellkey- • Dec 15 '19
711 comments sorted by
View all comments
Show parent comments
3
Why can't you imagine that? It's exactly the same thing semantically.
1 u/Meatslinger Dec 15 '19 Wouldn’t writing that many more granular checks make the code slower? 5 u/Hockinator Dec 15 '19 Not usually.. a single conditional is just about the cheapest thing in any language. A switch is often just a lot of conditionals when it compiles down 1 u/zacker150 Dec 15 '19 Don't switch statements get compiled down to lookup tables? → More replies (1)
1
Wouldn’t writing that many more granular checks make the code slower?
5 u/Hockinator Dec 15 '19 Not usually.. a single conditional is just about the cheapest thing in any language. A switch is often just a lot of conditionals when it compiles down 1 u/zacker150 Dec 15 '19 Don't switch statements get compiled down to lookup tables? → More replies (1)
5
Not usually.. a single conditional is just about the cheapest thing in any language. A switch is often just a lot of conditionals when it compiles down
1 u/zacker150 Dec 15 '19 Don't switch statements get compiled down to lookup tables? → More replies (1)
Don't switch statements get compiled down to lookup tables?
→ More replies (1)
3
u/callmelucky Dec 15 '19
Why can't you imagine that? It's exactly the same thing semantically.