I like the “with” statement. | Elixir / Phoenix

It’s been 3 months since I’ve started to write codes with Elixir.
Elixir isn’t a famous language in Japan, so it’s hard to find a guy who knows how to write the best code in Elixir.

Actually, just because it’s a “job” makes me being conscious to finish it speedily and we can not make some time for refactoring our codes.

However, I personally want to write it down about my knowledge that I currently think it is a better or best way.

If you were also an Elixir Programmer or something, please comment me!

The first story about Elixir is “with” statement. My colleague started to study Elixir before I join a project, and she often uses “if” statement a lot, and that makes some nests because she also has to finish a job rather than taking time for refactoring or studying.

a sample Nested by if statement ( I do not like )

Yes, I know someone like this way….
But we use Elixir, so I personally do not like to use “Control or Condition Syntax” as possible.

Elixir has the “with” statement. ( I did not understand what for it at first. )
So I always use “with” statement when doing something which needs some conditions passed.

Code by “with” statement ( I do like )

--

--