ComenzarEmpieza gratis

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 
}

Este ejercicio forma parte del curso

Intermediate R for Finance

Ver curso

Instrucciones del ejercicio

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

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

micr <- 57.44

# Fill in the blanks
if( micr < 55 ) {
    print("Buy!")
} ___ {
    ___
}
Editar y ejecutar código