https://kotlinlang.org logo
#announcements
Title
# announcements
w

witoldsz

06/08/2017, 2:30 PM
Hello, where can I find how exactly does
with (x) {a() b() c()}
work? Do the
a()
and
b()
execute on the same instance of
x
, or do the result of
a()
can "update" the
x
, so the following methods run on what
a()
returned?
t

thanksforallthefish

06/08/2017, 2:34 PM
witoldsz: does this article from #feed help? https://medium.com/@rotxed/kotlin-a-deeper-look-8569d4da36f
btw, afai understood, it should be equivalent to have
x.a(); x.b()
, so I guess it
a()
is modifying
x
,
b()
will see the modified
x
k

kevinmost

06/08/2017, 2:49 PM
The former. If you want the latter, just like in Java, it would just be
x.a().b().c()
.
w

witoldsz

06/08/2017, 2:52 PM
Thanks
2 Views