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

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.

主站蜘蛛池模板: 柯坪县| 连平县| 邯郸市| 石城县| 承德市| 满洲里市| 广汉市| 义乌市| 乐业县| 呼和浩特市| 柯坪县| 长兴县| 江陵县| 阜康市| 顺昌县| 临泽县| 黑河市| 弋阳县| 宝丰县| 中方县| 八宿县| 长乐市| 宜昌市| 都江堰市| 庆城县| 洛扎县| 彭阳县| 勐海县| 丰都县| 潼南县| 石门县| 长宁区| 辽宁省| 靖州| 墨竹工卡县| 双柏县| 达孜县| 自贡市| 铁岭市| 拉萨市| 安庆市|