When expression
var grade = "A"
when (grade) {
"A" -> println("Great job!")
"B" -> println("Great job!")
"C" -> println("You passed!")
else -> println("Close! Be sure to prepare more next time!")
}
// print: Great job!
Comments
var grade = "A"
when (grade) {
"A" -> println("Great job!")
"B" -> println("Great job!")
"C" -> println("You passed!")
else -> println("Close! Be sure to prepare more next time!")
}
// print: Great job!