Control Flow
Use Cases & Syntax
Conditional evaluation
Inputs:
#If statement
a <- 2
b <- 1
if (a > b){
print("a is greater than b")}
#Else if statement
x <- 10
y <- 10
if (x > y){
print("x is greater than y")
} else if (x <= y){
print("x is less than or equal to y")
}
#Else statement
d <- 3
if (d > 5){
print("d is greater than 5")
} else if (d == 5){
print("d is equal to 5")
} else {
print("d is less than or equal to 5")
}Outputs:
Loops
Inputs:
Outputs:
Comparison Operators
Operator
Description
Resources
Last updated
