In Kotlin script a function must be invoked. A function in it self does not get executed. It's a declaration like a variable. So, change to
fun main() { println("Hello, World!") } main()
thank you very much... that was very useful...
can you tell how can i create a kotlin i.e., name.kt in intelliJ IDEA 2020.3 it is very confusing
Just create Kotlin class:
and how to run it??
remove "class newprogram{}"
Entry point in Kotlin (fun main) should be outside of any class.
Thank you so much....
请先登录再写评论。
In Kotlin script a function must be invoked. A function in it self does not get executed. It's a declaration like a variable. So, change to
thank you very much... that was very useful...
can you tell how can i create a kotlin i.e., name.kt in intelliJ IDEA 2020.3 it is very confusing
Just create Kotlin class:
and how to run it??
remove "class newprogram{}"
Entry point in Kotlin (fun main) should be outside of any class.
Thank you so much....