Answers for "kotlin return function"

2

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
1

kotlin variable in string

//Kotlin variable in string

//variables go in a ${} in a string, example
println("Happy ${age}th birdthday, ${name}!"
Posted by: Guest on October-08-2020
1

kotlin method return

fun sum(val a: Int, val b: Int): Int {
    return a+b
}

fun sum(val a: Int, val b: Int) = a + b
Posted by: Guest on April-20-2021
0

kotlin function return

fun sum(a: Int, b: Int): Int {
    return a + b
}
Posted by: Guest on April-07-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language