![]() ![]() ![]() Unreachable code analysis: Based on the type of an expression or the return type of a function the type system can determine when a portion of code is not reachable.īasically a nullable type is any data type which is able to keep null as its value.Type Inference: When a variable or property is declared and initialized it is not necessary to explicitly indicate its type, Kotlin can infer the data type based on the context.Nullability support gives a lot of options to avoid this kind of exceptions and drive them on a very elegant way. Nullable types: They are data types that allow us to keep null values, defining a type as nullable the compiler will run some validations at compile time to ensure a Null Pointer Exception won’t be thrown. ![]() ![]() Among the most important characteristics of Kotlin type system we have: Kotlin comes along with a very powerful typing system, it was created thinking on making the development process less verbose, more focused on giving value to the business and preventing errors as much as possible. This set of rules allow us to ensure that all the parts of our program integrate consistently, plus, a clear and robust type system allows the compiler to execute low-level optimizations that improve the code.Īdditionally, a consistent and robust type system should give enough understanding of the business logic and the program in general through, for example, defining the properties of the business’s models. Type systems are a set of rules that determine the types of language construct. ![]()
0 Comments
Leave a Reply. |