I am having a hard time understanding lambda expre...
# getting-started
t
I am having a hard time understanding lambda expressions in Kotlin...
c
they're a way to pass behaviour, instead of data.
👍 1
a
A lambda is just an easy way to send a function to someone
👍 1
m
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
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.