Kotlin supports this possibility since its first release, and it is called null safety. This way, you can avoid the danger of null references, and you do not have to wait for exceptions or errors to be thrown at runtime. Consequently, any variable cannot contain the null value unless you explicitly say it can. This is why a few programming languages introduced the possibility to indicate that a variable is nullable, or in other words, that it can accept the null value. This leads to several issues that may be difficult to address while programming. One of the most common problems coming with programming languages is that accessing a variable with a null value causes a null reference exception at runtime. A complete guide to null safety in Kotlin Spreading knowledge through writing is my mission. Antonello Zanini Follow I'm a software engineer, but I prefer to call myself a technology bishop.
0 Comments
Leave a Reply. |