Kotlin Trivia 2

Let’s play another Kotlin trivia with us today!

The trivia

Add 3 lines of code outside the main function to make it print: Thank you, JetBrains!

fun main() {
    Localazy `❤️` Kotlin
}

The solution

The solution is very simple. Just create an infix function with Unicode name wrapped in backticks.

private infix fun Unit.`❤️`(text: String) = println(text)
private val Localazy = Unit
private val Kotlin = "Thank you, JetBrains!"
fun main() {
    Localazy `❤️` Kotlin
}

See the whole project on Github.

Do you like it? Do you have your own trivia? Let us know!


This is a companion discussion topic for the original entry at https://localazy.com/blog/kotlin-trivia-2