- Mastering Elixir
- André Albuquerque Daniel Caixinha
- 117字
- 2021-08-05 10:42:49
Control flow
We're now introducing control-flow constructs. In Elixir, they aren't used as often as in traditional imperative languages, because we can fulfill our control-flow needs, using a mix of pattern matching, multi-clause functions, and guard clauses. Whenever you're about to use one of the constructs we're presenting in this section, stop and check whether it's possible to employ a more functional approach. Code without these traditional control-flow constructs is usually easier to understand and test. If you get to a point where you have nested conditionals, it's almost guaranteed you can simplify it by using one of the approaches I mentioned earlier. Either way, you'll occasionally use these constructs, so it's important to know they exist.
推薦閱讀
- 數據科學實戰手冊(R+Python)
- INSTANT Sencha Touch
- Git高手之路
- 實戰低代碼
- Securing WebLogic Server 12c
- JavaScript:Moving to ES2015
- JavaCAPS基礎、應用與案例
- ASP.NET Core 2 Fundamentals
- Windows Phone 7.5:Building Location-aware Applications
- Cybersecurity Attacks:Red Team Strategies
- Go語言從入門到精通
- OpenCV Android開發實戰
- 微前端設計與實現
- Groovy 2 Cookbook
- R語言實戰(第2版)