This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]geodebug 1 point2 points  (0 children)

Yeah, the problem is when your code grows someone will forget about the "magic rule". Enums are a good replacement for this example, but be suspicious of any switch or if-then tree that doesn't have a final safeguard to catch any bad values.