Skip to content

#kotlin

62 posts · page 2 of 8

Scope function

1 min read

When I started doing Kotlin, the one that confused me the most was scope functions. However, once I understand what it is, it becomes my most favorite Kotlin feature. It makes code clear, concise and…

Resource Cleanup

1 min read

Using try, catch and finally blocks for resource cleanup is tedious and error-prone. In fact, Kotlin has a library functions that could help us to manage cleanup for us.

Nothing

1 min read

What is Nothing in Kotlin? Does it even exist? A Nothing return type indicates a function that never returns. This is usually a function that always throws an exception.

Check Instructions

1 min read

Check Instructions are like assert - they act like a constraints that must be met before it could proceed. Usually, they are used to validate function arguments and results. Check instructions typica…

Companion Object

1 min read

If you don't need to tie member functions to the object, consider for companion object. Regular class elements can access the elements of the companion object, but the companion object elements canno…

Inner class

1 min read

Inner class is like nested class, but an object of inner class maintains a reference to the outer class. inner has implicit link to outer class.