Learning Kotlin: todo

Submitted by Robert MacLean on Fri, 08/24/2018 - 09:00
**More Information** * This is the 24th post in a multipart series. If you want to read more, see our [series index](/learning-kotlin-introduction)

This post will be a shorter than normal one, as we are looking at a small feature that is easy to explain but can have major impacts to your code base and that is the todo function.

To use it, you simply call it and optionally pass in a string which gives a reason why that code is not done. For example:

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

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