November 2018
Intermediate to advanced
388 pages
9h 5m
English
Kotlin is a statically-typed language. It executes the type inference for us, so we don't have to specify types. Consider the code for 3a_TypeInference.kts:
val message = "Hi there"println(message)
When we run this code, we get the following output:

We can also explicitly specify the type. Consider the following code:
val message : String = "Hi there"println(message)
This is an example of creating a variable of the String type and printing it in the console. This looks like Scala syntax and it is quite different from what we do in Java.
In Java, we would write this as follows:
String message = "Hi there";
Languages such as ...
Read now
Unlock full access