DEV Community

Discussion on: Using Elixir's "with" statement.

Collapse
 
simonmcconnell profile image
Simon McConnell • Edited

Why jam the first two checks into the with statement and create noise?
You don't have to use with for everything just because you like it. I think point 6 is debatable.

You could just say "if not email address or length isn't six return bad_request, else ..."

Collapse
 
martinthenth profile image
Martin Nijboer

Fair point. Adding an if else statement increases scope nesting and could add noise too. If that improves the readability / perceived logic flow of your code, then go for it. :)