Lambda ( { -> } )
Unnamed function.
Syntax
val f = { p: Type -> expression }Description
Written inside curly braces as { parameter -> expression }. Frequently used in places like map/filter; a single parameter is accessed via it.
Example
Loading editor…
This language is for reference/learning only — copy the code and try it in your own environment.
Expected output
36 [2, 4, 6]
When to use?
map/filter callbacks, short utility functions.