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

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.

主站蜘蛛池模板: 尖扎县| 京山县| 达尔| 溆浦县| 阜南县| 元朗区| 汤原县| 乐山市| 江都市| 百色市| 贵德县| 新河县| 金山区| 武功县| 高阳县| 北票市| 永仁县| 谢通门县| 绥芬河市| 如皋市| 广水市| 大渡口区| 民勤县| 勐海县| 县级市| 泽库县| 电白县| 正阳县| 开封县| 沧州市| 教育| 新邵县| 汤阴县| 怀柔区| 达孜县| 鄄城县| 海晏县| 安庆市| 贞丰县| 德安县| 万全县|