`variable?.run{ }` == run this block if this thing...
# getting-started
m
variable?.run{ }
== run this block if this thing is not null? correct?
✔️ 1
r
Yes, but keep in mind it uses
variable
as it’s context. Lets say
variable
contains some member function foo, and we’ll look at how all the neato blocks return:
Copy code
val result = resultvariable?.run{
  foo()
}

result == Unit

val result = variable?.apply{
  foo()
}

result == variable

val result = variable?.let{
  it.foo()
}

result == result of foo()

val result = variable?.also{
  it.foo()
}

result == Unit
Hope this helps!