Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
One thing to mentioned, in Elixir Programming:
The reason I’ve waited so long to introduce them is that I want you to try not to use them much. You definitely will, and should, drop the occasional if or case into your code. But before you do, consider more functional alternatives. The benefit will become obvious as you write more code—functions written without explicit control flow tend to be shorter and more focused. They’re easier to read, test, and reuse. If you end up with a 10- or 20-line function in an Elixir program, it is pretty much guaranteed that it will contain one of the constructs in this chapter and that you can simplify it.
Thanks. I am new to it and don't know which one is best practice.
In this case I would not say one is better than the other. In a lot of more real world cases I do prefer different function heads to catch or guard against non-happy path implementations. Mostly because this prevents deep nesting of conditions which can quickly become hard to read.
Is this better than cond?
Could someone please tell me? Thanks.