As mentioned already, I sometimes share some fun and educational code snippets on Twitter. Here I present the whole pack for you to learn and enjoy. Let’s start with some fun :)

How is that even possible? fun is a hard keyword in Kotlin, but only lowercase. This is why we can name classes, or like in this example type parameter, as Fun . Hard keywords can be also used as names when we surround them with backtick characters (formally Grave accent). This is a Kotlin way to allow usage of names from Java that are reserved keywords in Kotlin:

`when`(dao.inspections).thenReturn(Flowable.just(Inspection())

assertThat(inspection.id, `is`(1))

It is also popular to use it to give descriptive names to unit tests. This lets us also use emoji:

Having fun with Kotlin, we can also remind ourselves some old songs:

We can also play with operator overloading while reminding ourselves good old cartoon:

Good to know

There are some possibilities that Kotlin programmers often forget about. For example, the fold function which is one of the most powerful collection processing functions:

I reminded also about a few functions one can use to introduce interactions between elements:

This is it for now. If you want more, I should post the next part on medium in a month or two. First, I will post it all on Twitter, so follow me to get to know about it before;)