5) { print("The string is short!") } else { print("The string is long!") }"> 5) { print("The string is short!") } else { print("The string is long!") }"> 5) { print("The string is short!") } else { print("The string is long!") }">
val str = "Hello!"
if (str.length == 0) {
print("The string is empty!")
} else if (str.length > 5) {
print("The string is short!")
} else {
print("The string is long!")
}
The else-branches are optional in normal if-statements.