functions

Articles

Kotlin – How to pass a function as parameter

Recently, I’ve noticed that there are a few different ways to pass a function as parameter in Kotlin. In this post I will use 2 functions: sum and divide. We have to declare the sum function, in such way that it can receive the divide function as argument. The most common and often more convenient […]

, , , , , ,
Tutorials

Functions in Kotlin

In this post I will talk about 5 cool things that functions can do in Kotlin, better than methods in Java.   1. Forget about overloaded methods In Java, when you need the same method to have 1 parameter in one case and more parameters in another case, you would have to overload the method.

, , , , , ,
Tutorials

Introduction to Functions – Kotlin

In this post, I will try to explain how to write functions in Kotlin by doing a parallel with Java. It’s not rocket science or anything special in this post, but this is the way I understand and remember better how to write in Kotlin, myself (it’s something new to me too :) ), so

, , ,
Scroll to Top