Skip to content

Instantly share code, notes, and snippets.

@magdamiu
Created November 17, 2019 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magdamiu/44d88b01ba261b78c93bedb73bf09051 to your computer and use it in GitHub Desktop.
Save magdamiu/44d88b01ba261b78c93bedb73bf09051 to your computer and use it in GitHub Desktop.
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