- 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.
推薦閱讀
- INSTANT OpenCV Starter
- Learning Selenium Testing Tools with Python
- Three.js開發指南:基于WebGL和HTML5在網頁上渲染3D圖形和動畫(原書第3版)
- Implementing Cisco Networking Solutions
- 深入淺出Android Jetpack
- Eclipse Plug-in Development:Beginner's Guide(Second Edition)
- Java 9模塊化開發:核心原則與實踐
- Learning Unreal Engine Android Game Development
- C陷阱與缺陷
- Microsoft HoloLens By Example
- Spring Boot 2+Thymeleaf企業應用實戰
- 鋁合金陽極氧化與表面處理技術(第三版)
- 開發者測試
- Python High Performance(Second Edition)
- iOS程序員面試筆試真題與解析