Key Concepts

Review core concepts you need to learn to master this subject

R Control Flow

if (condition_to_check) { # execute code and don't check any more conditions } else if (other_condition_to_check & and_this_condition_to_check) { # execute code only if both are true and don't check any more conditions } else if (either_this_condition | or_this_condition ) { # execute code if either condition is true and don't go to else } else { # the default code if none of the conditions above are true }

Control flow involves the program deciding which code to execute. The decision-making is established through conditional statements, i.e. if, else if, and else. Each condition should compute to a logical TRUE or FALSE. You can use comparison operators like !, & and | to combine logical values.