1. Learn
  2. /
  3. Courses
  4. /
  5. Intermediate R for Finance

Exercise

If this, Else that

An extension of the if statement is to perform a different action if the condition is false. You can do this by adding else after your if statement:

if(condition) {
    code if true
} else {
    code if false 
}

Instructions

100 XP
  • Extend the last exercise by adding an else statement that prints "Do nothing!".