官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 宁都县| 灵武市| 泌阳县| 方城县| 霍林郭勒市| 二手房| 昆明市| 新郑市| 镇康县| 都兰县| 虎林市| 陆丰市| 古浪县| 平顺县| 许昌市| 盐边县| 九寨沟县| 兴和县| 凤阳县| 富裕县| 依安县| 玛沁县| 尚义县| 蒲城县| 汉源县| 和平区| 通道| 夏河县| 临桂县| 常宁市| 城市| 元谋县| 汶上县| 磴口县| 新兴县| 准格尔旗| 宣威市| 西藏| 炎陵县| 开化县| 博湖县|