If and While
If
if 2 + 2 == 2 {
print("it's actually two")
} elif 2 + 2 == 3 {
print("nevermind, it's three")
} else {
print("I'm bad at addition")
}result := if 2 + 2 == 2 {
"it's two"
} elif 2 + 2 == 3 {
"it's three"
} else {
"something else"
}
print(result)While
Last updated