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

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.

主站蜘蛛池模板: 鸡泽县| 赣州市| 阿图什市| 都匀市| 左贡县| 寻甸| 师宗县| 个旧市| 阳西县| 通许县| 隆尧县| 板桥市| 宜章县| 湖州市| 宁河县| 尼玛县| 海南省| 当阳市| 瑞金市| 临武县| 平安县| 平潭县| 屏东县| 开封市| 乌兰浩特市| 伊宁县| 清水河县| 葵青区| 长丰县| 龙川县| 盐津县| 古浪县| 铜陵市| 宿松县| 甘洛县| 灵山县| 永登县| 辛集市| 永清县| 乌海市| 龙井市|