19 lines
363 B
Plaintext
19 lines
363 B
Plaintext
let x = if (1 < 2) {
|
|
":)"
|
|
} else { // The else clause is required here as x is a string
|
|
":("
|
|
}
|
|
|
|
if (2 > 3) {
|
|
print("This should never execute.")
|
|
} // We can omit the else clause here
|
|
|
|
// We use else if for chaining
|
|
if (1 > 2) {
|
|
print("1 is less than 2")
|
|
} else if (2 == 3) {
|
|
print("2 is 3")
|
|
} else {
|
|
print("This should always execute.")
|
|
}
|