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?
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?
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
KT is a Kotlin source file, that is, a file with the source code of the application. A normal file with the source code.
KTS is a Kotlin Shell Script file. A Script file.
You can find more information here:
Browser other questions tagged kotlin extension
You are not signed in. Login or sign up in order to post.