Creating a Main.kt file

After creating our index.html page. Let's create our first Kotlin file. Name it as Main.kt or provide any desired name. Create a file in the src folder and write the following function inside:

    fun main(args: Array<String>) {      document.bgColor="FF0000"      val message = "Kotlin Blueprints"      println("Your first JS code using Kotlin")    }

Build the project, by selecting the Build | Build Project menu option. On expanding the project explorer on the left of your workspace you will have the following type of directory structure:

Make sure you double-check that the <script> tags are added in the <body>. They should match the name ...

Get Kotlin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.