Home > Back-end >  Kotlin not executable
Kotlin not executable

Time:07-07

Kotlin screenshot Hi, I tested a simple Kotlin program but it does not print out anything. What would be the causes? Thanks.

CodePudding user response:

Kotlin scripts (.kts) don't use a main function. You just put the code directly in the file at the top level. So your code declares an arbitrary function named main but doesn't call it.

CodePudding user response:

Make sure it has .kt extension under src\main\kotlin.

enter image description here

For more information: https://github.com/halilozel1903/KotlinTutorials

  • Related