Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
when with range
var age = 22
when (age) {
in 1..18 -> print("Age is in the range")
!in 18..110 -> print("Age is outside the range")
else -> print("None of the above")
} // => None of the above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment