are not DECLARED the same way // as function types val add = fun(a: Int, b: Int) = a + b val subtract: (Int, Int) !" Int = { a, b !" a - b } but passed / used as expressions as well fun report(operation: (Int, Int) !" Int) = println(operation.invoke(2, 2))
an extension function // literal to a type. Such lambda acquires the properties // of non-static method in the context class val addOne: Receiver.() !" Int = { data + 1 } val two = addOne(Receiver(1)) val twoAgain = Receiver(1).addOne()
val director: String get() { … } val releaseDate: String get() { … } private companion object { const val TITLE = "title" const val DIRECTOR = "director" const val RELEASE_DATE = "releaseDate" } }