What does this boundary parser print?
kotlin
sealed interface Quantity {
data class Valid(val value: Int) : Quantity
data class Invalid(val raw: String?) : Quantity
}
fun parse(raw: String?): Quantity {
val value = raw?.trim()?.toIntOrNull()
return if (value != null && value in 1..10) {
Quantity.Valid(value)
} else {
Quantity.Invalid(raw)
}
}
fun main() {
println(listOf(" 3 ", "0", null).map(::parse))
}