News for hackers. Stuff that matters.
Re:Practicing Elixir or any programming language by Alacart on Friday August 25, 2017 @05:13AM (#15097142)
Pattern matching is awesome and we should make use of it whenever appropriate, but not every situation is appropriate. For instance, if your formatted_hour functions were larger, or shared some amount of code between them, then cond might be a great option instead. Or case, or even the dreaded if statement. As a community, sometimes we overuse our cool special features just because we have them! Personally, I like the case statement as a middle ground for lots of scenarios. You still get pattern matching and it's pretty readable.
Re:Practicing Elixir or any programming language by midgetjones on Friday August 25, 2017 @05:41AM (#15097229)
If the formatted_hour functions were larger or shared some amount of code, I wouldn't have suggested it ;)