0Pricing
R Academy · Lesson

Control Flow Statements

Use if-else statements, for-loops, and while-loops to guide the execution of your code.

1

Introduction to Control Flow in R

Control flow statements allow you to control the execution of your code using conditions and loops.

Control Flow Statements — illustration 1

2

Using if Statements

The if statement runs code only if a condition is true.

x <- 10
if (x > 5) {
  print('x is greater than 5')
}

All lessons in this course

  1. Writing Functions in R
  2. Control Flow Statements
  3. Debugging Techniques
← Back to R Academy