KT
kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* Lambda Expressions
**/
/*
Lambda expressions (or function literals) are
also not bound to any entity such as a class,
object, or interface.
// (They can be passed as arguments to other functions called higher-order functions.)
A lambda expression represents just the block
of a function, and using them reduces the
noise in our code.
Here are the characteristics of a lambda
expression in Kotlin:
- It must be surrounded by curly braces {}.
- It doesn't have the "fun" keyword.
- There is no access modifier (private,
public or protected) because it doesn't
belong to any class, object, or interface.
- It has no function name. In other words,
it's anonymous.
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run