as you can see, as the OP explains at the answer, if ran as a .kts file (kotlin but script) it won't need a main function as it starts from the top. What are y'all opinions on this? how should this case be treated?

  • 1
    \$\begingroup\$ I don't see why this wouldn't be entirely allowed. \$\endgroup\$
    – pxeger
    Jan 31 at 18:36

1 Answer 1


In this case "Kotlin" and "Kotlin script" are different languages. Both languages have implementations so they are indeed languages and because they are triggered by a change in the file extension they are different languages. The same has been done for e.g. Literate Haskell in the past since it requires the .lhs extension.

If writing Kotlin script is more fun for you then go ahead and do that. Which you want to use is up to you and the two are obviously different that there is no point in comparing them. That is a Kotlin script answer is not necessarily better than a Kotlin answer merely because it is shorter.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .