Created
February 6, 2022 15:50
-
-
Save arsalankhan994/4fc953a7c8369cd1167aadeb909ac8f1 to your computer and use it in GitHub Desktop.
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() { | |
// Type Checking | |
// Initializing list with String, Int and Boolean value | |
val list = listOf<Any>("Erselan Khan", 21, false) | |
// loop on above list | |
list.forEach { | |
when(it) { | |
is String -> println("String value is: $it") | |
is Int -> println("Int value is: $it") | |
is Boolean -> println("Boolean value is: $it") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment