summaryrefslogtreecommitdiffhomepage
path: root/kotlin.html.markdown
diff options
context:
space:
mode:
Diffstat (limited to 'kotlin.html.markdown')
-rw-r--r--kotlin.html.markdown7
1 files changed, 7 insertions, 0 deletions
diff --git a/kotlin.html.markdown b/kotlin.html.markdown
index 48abce3a..c16b5db1 100644
--- a/kotlin.html.markdown
+++ b/kotlin.html.markdown
@@ -120,6 +120,13 @@ fun helloWorld(val name : String) {
println(even(6)) // => true
println(even(7)) // => false
+ /*
+ You can also use lambda functions, with the '->' operator seperating
+ the parameters from the function body.
+ */
+ fun fooLambda: (Int) -> Int = {n -> n + 1}
+ println(fooLambda(1)) // => 2
+
// Functions can take functions as arguments and return functions.
fun not(f: (Int) -> Boolean): (Int) -> Boolean {
return {n -> !f.invoke(n)}