121
True crime (lemmy.ml)
submitted 1 month ago by tfm@europe.pub to c/programmerhumor@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] HelloRoot@lemy.lol 31 points 1 month ago* (last edited 1 month ago)

The only flaw is that the console.log states that null means user is not logged in.

If there are three or more explicit states, you should not use a nullable bool, but some more explicit data structure, like enum.

For example, if the state comes from a db, the user could be successfully logged in, but somehow for a range of possible reasons this variable ends up as null and you'll have a hell of a time debugging.

[-] bleistift2@sopuli.xyz 5 points 1 month ago
this post was submitted on 14 Aug 2025
121 points (96.9% liked)

Programmer Humor

38572 readers
384 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS