File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -9,23 +9,34 @@ Lambda functions ("lambdas") are a simple way to create functions ad-hoc. Lambda
99``` kotlin
1010fun main (args : Array <String >) {
1111
12- // All examples create a function object that performs upper-casing.
13- // So it's a function from String to String
12+ // All examples create a function object that performs upper-casing.
13+ // So it's a function from String to String
1414
15- val upperCase1: (String ) -> String = { // 1
15+ val upperCase1: (String ) -> String = { // 1
1616 str: String -> str.toUpperCase()
17- }
17+ }
1818
19- val upperCase2: (String ) -> String = { str -> str.toUpperCase() } // 2
19+ val upperCase2: (String ) -> String = { str -> str.toUpperCase() } // 2
2020
21- val upperCase3 = { str: String -> str.toUpperCase() } // 3
21+ val upperCase3 = { str: String -> str.toUpperCase() } // 3
2222
23- // val upperCase4 = { str -> str.toUpperCase() } // 4
23+ // val upperCase4 = { str -> str.toUpperCase() } // 4
2424
25- val upperCase5: (String ) -> String = { it.toUpperCase() } // 5
25+ val upperCase5: (String ) -> String = { it.toUpperCase() } // 5
26+
27+ val upperCase6: (String ) -> String = String ::toUpperCase // 6
28+
29+
30+ println (upperCase2)
31+ println (upperCase1)
32+ println (upperCase3)
33+ println (upperCase5)
34+ println (upperCase6)
2635
27- val upperCase6: (String ) -> String = String ::toUpperCase // 6
2836}
37+
38+
39+
2940```
3041</div >
3142
You can’t perform that action at this time.
0 commit comments