mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
[kotlin/en] Parentheses can be omitted for single lambda args (#4708)
This commit is contained in:
parent
094f083fbc
commit
ffe967e1ea
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user