Welcome to part 2 of my series on Kotlin. If you haven’t already, make sure you go back and read Why Kotlin is Dope: Part 1.


Really not much of a difference here, just no semicolon.



Extensions in Kotlin are a way to extend a class with new functionality. The most basic example of this is when we used to create a BaseActivity class in Java and have all the other activities in our project use inheritance MainActivity extends BaseActivity. I find Kotlin extensions to be much cleaner. How I do it is I create an extensions package in my code and create Kotlin files as so: ActivityExtensions.kt, FragmentExtensions.kt, and so on.