Kotlin has been a pretty steadily growing programming language over the last few years and yet I have never gotten a chance to use the language. Most of the work I do is in c# which doesn’t seem to be that different from Kotlin so I’m interested to see how long it will take me to get familiar with the language. I figured I would document how I go about getting started!
For those following along, there is official documentation that seems to be fairly straightforward. Maybe the IntelliJ IDEA is amazing, but I honestly hate having to download a full IDE just to try out a language. So instead of following that, I’m going to be using Visual studio code!
To get started, you are going to need to install the compiler. To do this, go ahead and run the following commands via the command line via Homebrew:
In order to support programming languages in VS Code, you are going to need to install an extension from the Visual Studio Marketplace. The extension that we need to download is called “Kotlin Language” by Mathias Fröhlich. See this screenshot below:
If you don’t already, Code Runner is another extension that you will need to have in order to execute Kotlin code in VS Code. Using the same process as before, look for “Code Runner” in the extension store. This extension is really useful for being able to execute a bunch of different code source.
Once you have everything downloaded, create a new file called “hello.kt” and add the following lines:
Upon saving the file, right click and select: “Run Code”
After compiling, you should see an output window appear. Here’s what mine looked like!
Congratulations, you’ve just run your first Kotlin code! Next post, we’ll get into the fun stuff but for now, we have everything ready to go 😎
Thank you for reading this far. If you enjoyed this post, please share, comment, and press that 👏 !
Follow me on Twitter and Medium if you’re interested in more in-depth and informative write-ups like these in the future!