im not sure I am a fan of kotlin's `it` implicit p...
# getting-started
r
im not sure I am a fan of kotlin's
it
implicit parameter keyword in lambdas. is using
x ->
an alternative? like
all { element -> fn(elemenet) }
instead of
all { fn(it) }
is this a respectable / idiomatic practice in kotlin?
g
Of course, you can use any variable name. In a lot of cases, if you use
it
the code becomes more readable and sounds more like an english sentence. I would advice to use
it
in small lambdas, where it is clear, what
it
means. For longer or nested lambdas, you could and should use named parameters
r
thanks
k
Sometimes a method reference can be just as readable:
all(::fn)
👆 2