Control structures in R allow you to control the flow of execution of the program, depending on runtime conditions. Common structures are
if,else: testing a conditionfor: execute a loop a fixed number of timeswhile: execute a loop while a condition is truerepeat: execute an infinite loopbreak: break the execution of a loopnext: skip an interation of a loopreturn: exit a function
Most control structures are not used in interactive sessions, but rather when writing functions or longer expresisons.