Functions In Kotlin
Functions are an essential part of any programming language
In the previous two articles, I have written on the basics of Kotlin. The focus of this article is Functions.
In Kotlin, functions do not need a class, which differs from some of the other widely used programming languages like Java, C#, etc.
It’s advisable to read my earlier articles before proceeding further.
- Say Hi to “Kotlin”. I started my career as a Java… | by tarun bhatt | Sep, 2021 | Medium
- Kotlin Basics. In my previous article, I provided an… | by tarun bhatt | Sep, 2021 | Medium
I will be covering the following sections in this article:
- Function expressions
- Local Functions
- Functions with default parameters
- @Jvm overloads
- Functions with Named parameters
- Extension functions
- Inflix functions
- Tail recursive functions
There is a lot to cover but first, let us look at a basic function definition.
fun doSomething(value: String) : String {
return “ “
}
fun keyword defines a function, and the return keyword returns a value to the calling…