Kotlin Named Argument

In this tutorial you will learn about the Kotlin Named Argument and its application with practical example.

Kotlin Named Argument

Kotlin named arguments allow us to pass an argument/value for specific function parameter by specifying parameter name in function call. This way it resolve the issue of conflict in argument list when we want to pass selected parameter arguments.

Table Of Contents

Example:- function call with named argument

Output:-

Here, we are using named argument (n2=15) specifying that the n2 parameter in the function definition will take this value (doesn’t matter the position of the argument).

In this tutorial we have learn about the Kotlin Named Argument and its application with practical example. I hope you will like this tutorial.