Using `with` and `case` in Elixir

  1. Use with to avoid nested case statements

2. Use case if there is only one level…

3. …unless using case leads to duplicated error handling

4. Use case if there are no clear success/error cases or more than two clauses and use with if the result is clearly either success or error.

5. Only use with with very restrictive matching

6. Use with/case when failure is the result of user/client input, that is, expected. Use |>with !functions when failure is not expected or would constitute a bug if it occurs.

7. Although practicality beats purity

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.