switch/case statements are horrible and should not be used, just write a fuckin if/elseif
there is *always* a chance that you forget the `break`, because it's an illogical syntax, and then your program flow is completely messed up
@vy imo they should just use a { } block for every case or something, but really I don't see the syntactic sugar benefit over normal if/else anyways
@f0x I think it’s a useful conceptual form that *some* languages expand on well. like ruby, where it has capabilities that would be wordy and unpleasant to express in normal if/else blocks.
a = case foo
when Integer, Float
foo
when /http(s)?/
bar
else
baz
end
You can stick anything in a `when` that responds to the matcher method, `===`
@f0x but like, javascript? anything that descends from c? hot garbage. It’s like goto but more useless
@f0x languages that need a `break` in the `case` are just baffling to me.
ones that don’t need a `break`, though, I think are pretty useful