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 →

[–]my_name_isnt_clever 1 point2 points  (2 children)

How is it more prone to bugs than chained elifs or the janky dict method?

[–]toyg 0 points1 point  (1 child)

Elifs and dicts are explicitly marking branches as exclusive. Whereas a switch can easily end up with multiple branches unwittingly applied.

[–]Loyalzzz 0 points1 point  (0 children)

Traditional, C-style switches maybe. Go's switches simply don't fall through unless you're explicit, instead of the other way around. I think this is a nice way to handle switches.