- if/else/else if
- Can be nested
if(TRUE){
print("Hello")
}
#Any number other than 0 is TRUE
x <- 3
if(x){
print("Hello")
}else{
print("Hey, There")
}
#if x -> 0, output would be Hey, There
y <- 2
if(x == y){
print("Hello")
}else{
print("Hey, There")
}
z <- 3
if(x < y & x < z){
print(x)
} else if(y < x & y < z){
print(y)
} else{
print(z)
}
#output -> 1 as x is < than y & z