Post your answer and then try in Ide. If your answ...
# announcements
a
Post your answer and then try in Ide. If your answers match, kindly reason this, you are great😉 . I couldn't understand the working of this one
k
5 5 15
s
robbe’s got it
k
Is that what the ide gives?
s
I haven’t tested but i’m entirely confident that’s the answer lol
a
@Kroppeb yes
But why could you explain
k
The reason is that your
5
isn't mutable
s
that’s not why
k
+=
is plusAssign() not
plus()
mmh not really correct either
x.plus(y)
is equivalent with
x+y
that's it
s
So these examples are predicated on a misunderstanding of lambda returns and how
if
works as an expression
k
the
if
is a statement here
s
exactly, it’s a statement and not an expression
need an
else
for that
the IDE is actually hinting at what’s going on — note how it presents the return hint only on the last line
a
@Kroppeb yup you are right. My bad. Thanks👍
k
also the
var
is marked as the value is never changed
but it is not marked with the
+=
as there, the value does change
o
5 5 15, fun exercise