I've recently started an Android course using Kotlin. I had heard about the new language and once it became an official language of Android I started thinking more about learning it. The course name is The Kotlin Developer Masterclass on Udemy, taught by Paulo Dichone.
Kotlin is fun
There are definitely things I like in Kotlin more than in Java. Kotlin is short and succinct. While it goes well beyond this, just a simple "Hello World" comparison shows some of this succinctness.Java
public static void main(String[] args) {
System.out.println("Hello, World");
}
Kotlin
fun main(args: Array<String>) {
println("Hello, world!")
}
Note the differences.
First, the function is declared with the simple fun. While I have seem some programmers online complaining about this, I like it. It's short and sweet and I think programming is fun so typing "fun" all the time is fine by me. On a more serious note, I like how more things can be inferred. If the return type is void (Unit in Kotlin) it doesn't need to be explicitly stated. What's more, if it's a single expression function and the compiler can infer the type, it doesn't even need to be indicated then. Less typing is a good thing.
fun double(x: Int) = x * 2
Second, println() is better than System.out.println(). The Kotlin builds upon the Java code and saves some typing and extra code to read through.
And third, semicolons are not required. I liked this when I took a look into Python. You'd think that with as much OmniScript I write on a daily basis that adding semicolons, which are required, would be automatic, but I still find that I forget them here and there. I won't miss having to add while writing Kotlin.
I have some fun app ideas that I want to get to, but in the meantime I'm enjoying learning the differences between Kotlin and Java and the other languages I've worked with.