https://kotlinlang.org logo
#language-proposals
Title
# language-proposals
r

Ruckus

05/11/2018, 7:22 PM
You have a formatting error. You need to move the
{
to the same line as the
let
s

sksk

05/11/2018, 7:22 PM
Yes i know, i mean what are the reasons why it’s not allowed ^^
r

Ruckus

05/11/2018, 7:24 PM
Ah, I see. In that case, I don't know, but this isn't the right channel to ask. Read the channel topic:
All discussion in this channel should begin with a use-case or proposal instead of a question.
k

karelpeeters

05/11/2018, 7:26 PM
I'd guess it's because a newline basically counts as a
;
A puzzler:
Copy code
val a = longExpressionThatbasicallyTakesUpTheWholeLine
    + 2
I've been bitten by this a bunch of times.
r

Ruckus

05/11/2018, 7:30 PM
@karelpeeters Not true. For example, the following requires an explicit
;
to avoid exactly what @sksk is trying to do:
Copy code
val callback: () -> Unit = if (true) {
    test();  // required ;
    { println("yep") }
} else {
    test();  // required ;
    { println("nope") }
}
Without the
;
, it thinks it's a param to
test
.
@sksk Interestingly, this works just fine:
Copy code
_screen?.let()
{
    it.pause()
    _prevScreen = it
}
s

sksk

05/11/2018, 7:40 PM
oh you are right i tested it works fine
r

Ruckus

05/11/2018, 8:05 PM
It may be a bug. You should file it.
2 Views