Learning Kotlin: todo

Note This is the 24th post in a multipart series. If you want to read more, see our series index.

This post will be shorter than normal, as we are looking at a small feature that is easy to explain but can have major impacts on your codebase—that is, the todo function. To use it, you simply call it and optionally pass in a string that explains why the code isn’t done. For example:

fun main(args: Array<String>) {
    todo("Haven't started")
}

This will throw a NotImplementedError when encountered. What I like about this is that we are being explicit about the intent. Additionally, it makes it easy to find in your IDE of choice.