Default arguments vs overloads, when to use which
In Kotlin there are two ways to express an optional parameter, either by specifying default argument value: fun foo(parameter: Any, option: Boolean = false) { ... } or by introducing an overload: fun foo(parameter: Any) = foo(parameter, false) fun foo(parameter: Any, option: Boolean) { ... } Which way is preferred in which situations? What is the difference for consumers of such function? Jayson Minard In Kotlin code calling other Kotlin code optional parameters tend to be the norm over using overloads. Using optional parameters should be you default behavior. Special cases FOR using defaulted