Learning Kotlin: Default values

Submitted by Robert MacLean on Mon, 06/18/2018 - 09:00
**More Information** * [Code for the 4th Koan can be found here](https://github.com/Kotlin/kotlin-koans/tree/master/src/i_introduction/_3_Default_Arguments). * This is the 4th post in a multipart series. If you want to read more, see our [series index](/learning-kotlin-introduction) Previously we covered [Named Arguments](/learning-kotlin-named-arguments) and this is a small continuation from it, we start with a simple function `fun foo(name: String): String = todoTask3()` and we need to have it call a single Java function and to provide it with default values which ultimately looks like this: fun foo(name: String, number: Int = 42, toUpperCase: Boolean = false): String = JavaCode3().foo(name, number, toUpperCase)