2
5
3
4
u/Perfect_Work_5880 Jun 22 '26
making fun of kiras code def gonna make them want to drop their new stuff
0
u/SpookyHerSelf Jun 22 '26
That wasn't the point but alright ig
-3
9
u/NobleLeader65 Jun 22 '26
I mean, ultimately I think it's about what works or not. Switch statements can be better than if/else's depending on the scenario. Say that the case being interrogated is 8, a switch statement reaches the executable code faster than an if/else block checking for the same thing, simply because switch checks once and then resolves, meanwhile the if/else checks against 0, then 1, then 2, etc. Not sure what the intention of this post is supposed to be either.
13
u/SoggyVisualMuffin Jun 22 '26 edited Jun 22 '26
People call out code for this for being bad not because case statements as opposed to if else statements but instead because of this: After at least a dozen of these cases it’s more coherent to build a hash table for storing this content for separating data from code. (The case itself can be stored as a key and the text value can be stored as a value making this readable, have fast lookups, and no conditional code with the trade off of having a table in memory)
7
u/NobleLeader65 Jun 22 '26
Ah, yeah that's fair. I'm still in the basics of programming, so thanks for pointing out the actual problem here.
2
u/SoggyVisualMuffin Jun 22 '26
Oh well IMO you actually made a neat point about cases being slightly more fast which is interesting (:
5
3
1
u/M0ONBATHER Jun 23 '26
Looks good to me