• Dmitry Rubinstein
  • 23 February 2019
  • Comments

Try vs Case: The last battle

Versus

In this article we’ll try to battle different Elixir control structures in order to understand their efficiency and applicability in our projects.

TL;DR:

  1. You can use try with else - instead of case literally (only literally!);
  2. Never use with instead of case - only instead of case chains;
  3. Use try if you need it - for catch cases;
  4. Forget about throw and catch in your code - they are really slow;

Do you want to know, what literally means? Welcome under cut!