simple kotlin function example
Here's an example of a simple Kotlin function that takes in an integer parameter and returns the square of that number:
fun square(num: Int): Int {
return num * num
}
You can call this function elsewhere in your code like this:
val result = square(5)
println(result) // Output: 25
原文地址: https://www.cveoy.top/t/topic/f0Vr 著作权归作者所有。请勿转载和采集!