summaryrefslogtreecommitdiffhomepage
path: root/kotlin.html.markdown
diff options
context:
space:
mode:
authorMichael Härtl <mh@m-h-it.de>2024-05-13 10:38:50 +0200
committerGitHub <noreply@github.com>2024-05-13 02:38:50 -0600
commitffe967e1ea8e916caf5a5bff810e3b7ae25ccb8f (patch)
tree02d06fcbb664037a4283d0624448d5645c1cb27a /kotlin.html.markdown
parent094f083fbcb36c1281b4d7fae149dff1afc0685d (diff)
[kotlin/en] Parentheses can be omitted for single lambda args (#4708)
Diffstat (limited to 'kotlin.html.markdown')
-rw-r--r--kotlin.html.markdown5
1 files changed, 4 insertions, 1 deletions
diff --git a/kotlin.html.markdown b/kotlin.html.markdown
index a6fac518..48abce3a 100644
--- a/kotlin.html.markdown
+++ b/kotlin.html.markdown
@@ -127,7 +127,10 @@ fun helloWorld(val name : String) {
// Named functions can be specified as arguments using the :: operator.
val notOdd = not(::odd)
val notEven = not(::even)
- // Lambda expressions can be specified as arguments.
+ /*
+ Lambda expressions can be specified as arguments.
+ If it's the only argument parentheses can be omitted.
+ */
val notZero = not {n -> n == 0}
/*
If a lambda has only one parameter