![]() However, what if you don't have a favorite actor? You might want to assign the variable a "Nobody" or "None" value. For example, when you declare a favoriteActor variable, you may assign it a "Sandra Oh" string value immediately. In Unit 1, you learned that when you declare a variable, you need to assign it a value immediately. A web browser with access to Kotlin Playground.How to provide a default value when a nullable variable is null with the if/else expression or the ?: Elvis operator.How to convert a nullable variable to a non-nullable type with if/else expressions. ![]()
0 Comments
Leave a Reply. |