Created
July 26, 2018 00:16
-
-
Save gorrotowi/cae94722d3823567b53c548f55c2bcfb to your computer and use it in GitHub Desktop.
Use data if objects is not null
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
| val name:String? = null | |
| val l:Int = if(name != null) name.length else -1 | |
| print(l) // -1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment