this post was submitted on 01 Jul 2023
17 points (90.5% liked)

Programming Humor

3232 readers
1 users here now

Related Communities !programmerhumor@lemmy.ml !programmer_humor@programming.dev !programmerhumor@kbin.social !programming_horror@programming.dev

Other Programming Communities !programming@beehaw.org !programming@programming.dev !programming@lemmy.ml !programming@kbin.social !learn_programming@programming.dev !functional_programming@programming.dev !embedded_prog@lemmy.ml

founded 2 years ago
MODERATORS
 

If only string maps were known to human kind :)

top 7 comments
sorted by: hot top controversial new old
[–] WaveWood@lemmy.world 10 points 2 years ago

Clearly the issue is that they are using switch cases instead of if statements /s

[–] bwrsandman@lemmy.world 4 points 2 years ago

Maps? Could get away with an array!

[–] nbdy@lemmy.world 3 points 2 years ago

How about a dict[int, str], which holds your case and newscript?

[–] Kojak747@lemmy.world 2 points 2 years ago

For shame, I recently did something like this, but only because a/ I have been programming for 3 weeks and b/ told chat gpt to edit my code. Either way, we both failed. Use arrays people!

[–] MelodiousShark@lemmy.world 2 points 2 years ago

Yes there is and, at least on reddit, you'd have people defending this code for no reason other than it works and the only bad code is code that doesn't work or something stupid like that.

[–] Ignisnex@lemmy.world 2 points 2 years ago

Case with numbers? I really want to change that to an enum or something lol.

[–] shotgun_crab@lemmy.world 1 points 2 years ago

I love how they even copied the comment