Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
if/else
val number = 0
val result = if (number > 0) {
"Positive number"
} else if (number < 0) {
"Negative number"
} else {
"Zero"
}
println(result) // => Zero
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment