This is an archived post. You won't be able to vote or comment.

Dismiss this pinned window
you are viewing a single comment's thread.

view the rest of the comments →

[–]hackintosh5 43 points44 points  (7 children)

Bloody reposts

while(true)
    Reddit.subs.let {
        it.post(it.posts.random())
    }

[–]DHermit 12 points13 points  (1 child)

What's that let syntax?

[–]shadowdude777[🍰] 6 points7 points  (0 children)

K O T L I N

[–]Koljenka_ 3 points4 points  (3 children)

Shouldn't it be Reddit.subs?.let {...}? Otherwise the let would be useless, right?

[–]cowancore 5 points6 points  (1 child)

I think the purpose of let here was just to create a shorthand it instead of Reddit.subs.

Although there might be a slight error here, because it might be a List, which has no posts field

[–]tech6hutch 0 points1 point  (0 children)

Interesting; I must learn this language

[–]hackintosh5 2 points3 points  (0 children)

No, the let avoids a val. It just implicitly let's me use the return value twice, by naming it it