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

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.

主站蜘蛛池模板: 竹北市| 加查县| 丹棱县| 中卫市| 儋州市| 石台县| 长宁县| 和龙市| 道真| 柳州市| 麟游县| 临泉县| 定安县| 会东县| 屏东市| 武安市| 武汉市| 小金县| 河间市| 马龙县| 博客| 拉孜县| 花莲县| 新郑市| 隆安县| 礼泉县| 简阳市| 嘉兴市| 池州市| 高清| 临城县| 博客| 铁岭市| 阿拉善盟| 黄浦区| 萝北县| 洛阳市| 彩票| 罗定市| 新宁县| 万荣县|