Kotlin Default Argument

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

Kotlin Function Argument

In Kotlin, we pass information in function call as its arguments and the function can either returns some value to the point it where it called from or returns nothing.

Kotlin Default Argument

Kotlin supports to assign default argument (parameter) values in a function definition, so when we call that function with no argument passed for a parameter then its default value assigned. When a function is called with argument, then these arguments is used as parameter values in function, but when a function is called or invoked without passing argument for any specific parameters than default parameter values been used as parameters value as per function definition.

Syntax:-

Example :- Function call with all arguments passed

Output:-

Example :- Function call with some arguments passed

Output:-

Example:- Function call with no arguments passed

Output:-

 

 

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