Created
June 6, 2018 02:12
-
-
Save systemhalted/22f5d1a13d0b5795f35da65b9d4d3aaf 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
var rainbowColor : String = "Blue" | |
rainbowColor = "Violet" | |
rainbowColor | |
Violet | |
val blackColor : String = "Black" | |
blackColor | |
Black | |
blackColor = "Blue" | |
error: val cannot be reassigned | |
blackColor = "Blue" | |
^ | |
rainbowColor = null | |
error: null can not be a value of a non-null type String | |
rainbowColor = null | |
^ | |
var greenColor : String? = null | |
var blueColor = null | |
greenColor | |
null | |
greenColor = "Green" | |
greenColor | |
Green | |
var listOfElements: List<String>? = null | |
var listOfElements1 : List<String?> = listOf(null, null) | |
listOfElements | |
listOfElements1 | |
[null, null] | |
var nullTest : Int? = null | |
println( nullTest?.inc()?: 0) | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment