Re:Elixir and Phoenix after two years
by ch4s3 on Monday April 05, 2021 @04:55PM
(#26704612)
> Sometimes simply reading a switch statement or if/else/then is much clearer
Case statements are pretty common, and for code I read the with statement[1] is even more common. This allows you to code a happy path broken into small steps and then collect your edge cases. It doesn't solve every case for if/else or cases, but it's a nice tool.
Case statements are pretty common, and for code I read the with statement[1] is even more common. This allows you to code a happy path broken into small steps and then collect your edge cases. It doesn't solve every case for if/else or cases, but it's a nice tool.
[1]https://hexdocs.pm/elixir/Kernel.SpecialForms.html#with/1