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 exercício faz parte do curso
Intermediate R for Finance
Instruções do exercício
- Extend the last exercise by adding an
elsestatement that prints"Do nothing!".
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
micr <- 57.44
# Fill in the blanks
if( micr < 55 ) {
print("Buy!")
} ___ {
___
}