Skip to content

Instantly share code, notes, and snippets.

@kalaiselvan369
Created June 8, 2023 11:24
Show Gist options
  • Save kalaiselvan369/3651e403aae9437b8b0f0b70e7e79d1f to your computer and use it in GitHub Desktop.
Save kalaiselvan369/3651e403aae9437b8b0f0b70e7e79d1f to your computer and use it in GitHub Desktop.
Checking for membership
fun main() {
val n = 130
if(n in 100..200)
println("$n is a member of 100 to 200")
inFloatRange(4.5)
}
fun inFloatRange(n: Double) {
val r = 1.0..10.0
println("$n in $r? ${n in r}")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment