https://kotlinlang.org logo
#getting-started
Title
# getting-started
t

therealbluepandabear

03/01/2021, 11:34 PM
I am having a hard time understanding lambda expressions in Kotlin...
c

crummy

03/01/2021, 11:40 PM
they're a way to pass behaviour, instead of data.
👍 1
a

asad.awadia

03/02/2021, 12:17 AM
A lambda is just an easy way to send a function to someone
👍 1
m

Moritz Mücke

03/02/2021, 7:32 AM
Are you familiar with higher-order functions? If not, maybe this should be the place were you start -> https://kotlinlang.org/docs/lambdas.html
m

Matteo Mirk

03/02/2021, 10:42 AM
lambda expressions are anonymous functions (they have no name) that you can manipulate just like other data types, eg: pass them to arguments, return them as values, assign them to variables. An expression like
(Int) -> Boolean
IS the type of a lambda, just like
Int
, meaning a function that takes an Int argument and returns a Boolean value.
2 Views