Kotlin : Single Expression Function

This post was originally posted at https://agrawalsuneet.github.io/blogs/kotlin-single-expression-function/ and reposted on Medium on 16th April 2021.
fun convertToFahrenheit(degree : Float) : Float {
return (degree * 9 / 5) + 32
}

println(convertToFahrenheit(degree = 11f))
fun convertToFahrenheit(degree : Float) = (degree * 9 / 5) + 32

println(convertToFahrenheit(degree = 11f))

Please continue reading at https://agrawalsuneet.github.io/blogs/kotlin-single-expression-function/

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store