Anatoly
07/09/2024, 10:39 AMval tmp: InputType -> OutputType = { input -> output }
🤔Sam
07/09/2024, 10:42 AM{ input -> output }
, is the lambda expression. The InputType -> OutputType
on the left is the type declaration. The lambda expression alone doesn't have the ability to specify a return type. But it doesn't need to when it's used in conjunction with an explicit type declaration.Sam
07/09/2024, 10:43 AMAnatoly
07/09/2024, 10:44 AMUlrich Schuster
07/09/2024, 1:34 PMSam
07/09/2024, 2:05 PMval lambda = { s: String -> s.length }
val anonymousFunction = fun(s: String): Int = s.length
Ulrich Schuster
07/09/2024, 3:13 PM