Instruction

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

What Is a Function?

A function is a block of code that performs a specific task. Whenever your app needs to execute the task, you call the function.

Predefined Functions

These are functions provided by the Kotlin standard library. They’re readily available for use. For example, println() :

fun main() {
  println("Hello Kotlin!!")
}
Hello Kotlin!!
import kotlin.math.max

fun main() {
  val largest = max(3, 4)
  println("The largest number is $largest.")
}
The largest number is 4.
See forum comments
Download course materials from Github
Previous: Introduction Next: Demo