Y
Hacker News
new
|
ask
|
show
|
jobs
by
5trokerac3
2605 days ago
If you're running through that many conditionals, it may be clearer to work them into a state enum that you can use with a switch.
1 comments
apta
2604 days ago
Golang doesn't have enums
link
5trokerac3
2604 days ago
Neither does JS, but there are ways to accomplish the same thing[0].
[0]
https://stackoverflow.com/questions/14426366/what-is-an-idio...
link
acdanger
2604 days ago
TypeScript does and it’s one of my favorite features.
link
apta
2604 days ago
That's not really the same. That's badly designed and error prone.
link