What is the difference between KTS and KT extensions?

Asked

Viewed 1,046 times

3

I am studying Kotlin and opened a Spring Boot project out of curiosity. I came across two files of different extensions, contento code Kotlin: .kts and .kt.

What is the difference between these two extensions?

2 answers

3


Kotlin supports execution in mode script more or less interpreted, so it is possible to execute something through a text, more or less as is possible in languages like C# through the .NET Compiler Platform. Since these codes usually have a slightly different semantics than a code to run compiled even directly on the executable, it is better to have a separation. Then the .kts is usually used to indicate that the code there should be executed by mechanism of script, and the .kt is the source to be compiled and generated a code that will be executed by the JVM or other compatible VM.

That’s why I say these technologies are better prepared to meet all scenarios.

Note that this mechanism of script should run inside Kotlin, it is not a shell.

3

Browser other questions tagged

You are not signed in. Login or sign up in order to post.