Last active
July 1, 2019 07:39
-
-
Save Temidtech/fb9b1d7f8dcf38cfbf482f0b9b6fe5b2 to your computer and use it in GitHub Desktop.
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
val soloList: List<Any> = listOf("Wakanda forever!", "Kotlin is fire!",2018,29.3,12.2837827,true) | |
for(value in soloList) { | |
when (value) { | |
is String -> println("String: '$value'. Capitalize :${value.capitalize()}") | |
is Int -> println("Integer: '$value'") | |
is Double -> println("Double: '$value'") | |
is Float -> println("Float: '$value'") | |
else -> println("Unknown Type") | |
} | |
} | |
// Here is the Output | |
String: 'Wakanda forever!'. Capitalize :Wakanda forever! | |
String: 'Kotlin is fire!'. Capitalize :Kotlin is fire! | |
Integer: '2018' | |
Double: '29.3' | |
Double: '12.2837827' | |
Unknown Type |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment