Created
June 8, 2023 11:24
-
-
Save kalaiselvan369/3651e403aae9437b8b0f0b70e7e79d1f to your computer and use it in GitHub Desktop.
Checking for membership
This file contains hidden or 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
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