sugargre.blogg.se

Kotlin online ide
Kotlin online ide







kotlin online ide kotlin online ide

Run your code and you’ll see the phrase This is an alert in your browser as a result of executing the second line: In this section, you’ll change the target platform to JS to run JavaScript from Kotlin.Ĭonsole.log("Hello " + args.joinToString()) On these kinds of projects, you’ll want to try a few things related to Kotlin and JavaScript interoperability. Kotlin/JS enables server-side web development, such as Node.js, and client-side web development, such as jQuery and React. It’s possible to call JavaScript from Kotlin and vice versa.

kotlin online ide

In the next sections, you’ll change the target platform to run JavaScript, draw to a Canvas and even run unit tests. It’s used to run JVM programs, such as the Hello World console app you modified. Note that the JVM target platform is already selected. In this section, you’ll learn what it means to your Kotlin code to change the target platform. Kotlin has the magical ability to run on different platforms. Great! Now that you can pass arguments into your playground, you’ll play around with changing the runtime virtual machine. Run the playground again and you’ll see the following output: Choose or type joinToString() to get the desired output: It’s better to show the names separated by commas, right? Do so by adding a dot to the right of the args parameter, and you’ll see the following: Run the program, and you’ll see the following output: Now, change main to receive those arguments: One way to test your Kotlin code is by passing in arguments into your playground. You’ll start by passing arguments into your app.

  • Target Platform: Select JVM, JS, CANVAS or JUNIT as targets for the code you write.
  • Program arguments: Set input arguments for your main function.
  • Kotlin Version: Choose the version to build your program.
  • In this section, you’ll a look at each configuration and how it affects the playground. Playgrounds allow you to configure parts of the environment. Note there’s already a Hello World program written for you.Ĭlick Run, located on the right, to build and run the code.īecause this is a console app, it will print Hello, world!!! in console output.

    kotlin online ide

    To open the playground, go to, where you’ll see the following: If you’re unfamiliar with the language, review our Kotlin for Android tutorial first. Note: This tutorial assumes you have experience developing in Kotlin.









    Kotlin online ide