Answers for "kotlin function"

4

function kotlin

// Declare a function in Kotlin
fun happyBirthday(name: String, age: Int): String {
    return "Happy ${age}th birthday, $name!"
}
// Call function
val greeting = happyBirthday("Anne", 32)
Posted by: Guest on October-24-2020
2

kotlin function

fun sum(a: Int, b: Int): Int {
 return a + b
}
Posted by: Guest on January-15-2021
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
0

make function kotlin

fun main() {
	println("This is a function")
}
Posted by: Guest on January-14-2021
0

function in kotlin

kotlin function
Posted by: Guest on June-27-2021
0

how to do a function kotlin

//Okay I found a couple of examples, but I think this one should help the beginners out there who need the syntax!

fun callMe() {
    println("Hello")
    println("cool")
}

fun main() {
    callMe()
    println("Printing outside from callMe() function.")
}

//I hope it helps out! I try to make new languages hopefully easy for you to learn!
Posted by: Guest on July-26-2021

Browse Popular Code Answers by Language