kotlinquine

Shortest quine in Kotlin?


What's the shortest quine written in Kotlin language?

See my implementation in answers, but I believe a shorter one exists.


Solution

  • Here is a straightforward implementation in kotlin script:

    val a="val a=%c%s%c%nprint(a.format(34,a,34))"
    print(a.format(34,a,34))
    

    Tested with:

    $ kotlinc -script quine.kts > out.kts
    $ diff -s quine.kts out.kts
    Files quine.kts and out.kts are identical
    

    Number of chars:

    $ stat quine.kts
    Size: 71