DocumentationCore ConceptsConditionals
Conditionals
Learn how to control the flow of your Spark programs using conditional statements.
If Statements
Execute code based on conditions using if statements.
let age 18
if age >= 18 {
print "You are an adult"
}
# If-else
let temperature 25
if temperature > 30 {
print "It's hot"
} else {
print "It's comfortable"
}Else If Chain
Handle multiple conditions using else if.
# Example with variables a and b
let a 10
let b 20
if a > b {
print "a is greater"
} else if a === b {
print "equal"
} else {
print "b is greater"
}