Request: Need more examples in the docs for learners


As someone who is learning Kotlin, more examples would be a HUGE help.

e.g. I Google what is the “Kotlin-y way” of reading characters from a socket and land on

Which is fine - but it isn’t the easy/fun way to make it work. The perfect* example sitting on that page would be:

// Read everything at once
// regular BufferedReader if you need to get creative
socket.getInputStream().bufferedReader().use { input -> ... }

and then I would think “Hey, readText looks useful. And I forgot to use use, that is way better!”

* for some value of perfect


We are working now on adding more examples. We haven’t gotten to bufferedReader yet, but we’ll get there.


Is crowdsourcing an option?


Yes, you’re welcome to submit examples. Here’s a recently accepted PR adding some examples: