Answers for "keyword to use to define a function in kotlin"

1

how to write a function in kotlin

// Use 'fun' keyword to declare function
// 'num' is the parameter and is of type Int
// The ':Int' indicates the return type
fun square(num: Int):Int {
    return num * num
}
Posted by: Guest on November-06-2020

Code answers related to "keyword to use to define a function in kotlin"

Browse Popular Code Answers by Language