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

Complex logic with control structures

The final topic we should cover is how to introduce complex logic by using control structures. When I write introduce complex logic, I don't mean to imply that it's complex to do so. Complex logic refers to code that has multiple possible paths of execution, but in reality, it's quite simple to implement it.

Nearly every operation in R can be written as a function, and these functions can be passed through to other functions to create very complex behavior. However, it isn't always convenient to implement logic that way and using simple control structures may be a better option sometimes.

The control structures we will look at are if... else conditionals, for loops, and while loops. There are also switch conditionals, which are very much like if... else conditionals, but we won't look at them since we won't use them in the examples contained in this book.

主站蜘蛛池模板: 石渠县| 兴安县| 手机| 万州区| 新晃| 铁力市| 彭州市| 韩城市| 杭锦后旗| 维西| 陵川县| 清苑县| 沂水县| 理塘县| 陆良县| 贞丰县| 江北区| 灵武市| 日照市| 新乐市| 鄯善县| 淮滨县| 孝昌县| 巴林左旗| 河南省| 嫩江县| 峨边| 确山县| 河北省| 通许县| 建昌县| 天水市| 云安县| 南京市| 循化| 吴桥县| 当雄县| 泗洪县| 安宁市| 高青县| 宣威市|