Check out example codes for "kotlin higher order functions". It will help you in understanding the concepts better.

Code Example 1

fun main() {
    higherOrderSequence(5, ::square)


fun higherOrderSequence(num: Int, myFunc: (Int) -> Int) {
    // A function declared as an argument must specify input and return type

    for (x in 1..num) {
        print("${myFunc(x)} ")

fun square(num: Int):Int {
    return num * num

Code Example 2

They are called lambdas ;)

Learn ReactJs, React Native from