Created
November 17, 2019 21:37
-
-
Save magdamiu/44d88b01ba261b78c93bedb73bf09051 to your computer and use it in GitHub Desktop.
when with range
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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