DEV Community

Discussion on: How to use Kotlin's 'it also let apply run'

Collapse
 
worker8 profile image
Tan Jun Rong

thanks for reading <3

val and var can be difficult to get used to at first, because you have to always decide it upfront, unlike in java-land. I remember it as val being value and var being variable. (so when you give it a value, it's fixed, and won't be able to change; whereas variable as the name suggest, it can be changed). Perhaps after knowing this it will be easier.

I noticed that you called those four methods "magical".

Oh, on that.. it's actually half rhetorical... I say it 'magical' partly because it's so hard to understand. Another part is that it's because they are actually pretty interesting methods where I'm learning new concepts.

It's like a Mario pipe to me, where you pass in something into this pipe. Then, inside the pipe, something happened. When it comes out, it can be the same thing, or it can be a different thing.

Collapse
 
loilo profile image
Florian Reuschel

Weird yet nice analogy. 🙈

And thanks for clarifying. :)