Skip to content

Literals in kotlin

Devrath edited this page Feb 1, 2024 · 1 revision

What are literals in kotlin

What is kotlin literals

Kotlin literal means a constant value assigned to a variable

val x = 10 // Integer literal
val y = 13.8 // Double literal
val z = "Hello" // String literal

What is function literals

  • When we assign a function to a variable, It becomes a function literal
  • There are 2 types of function literal
    • Lamda Expression
    • Anonymous function
Clone this wiki locally