DEV Community

Cover image for Learning Kotlin: Programming with Visual Studio Code

Learning Kotlin: Programming with Visual Studio Code

mwrpwr profile image Joseph Maurer Originally published at josephamaurer.Medium ・3 min read

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!

Source: Visual Studio

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:

VS Extensions

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.

“Run code snippet or code file for multiple languages: C, C++, Java, JavaScript, PHP, Python, Perl, Perl 6, Ruby, Go, Lua, Groovy, PowerShell, BAT/CMD, BASH/SH, F# Script, F# (.NET Core), C# Script, C# (.NET Core), VBScript, TypeScript, CoffeeScript, Scala, Swift, Julia, Crystal, OCaml Script, R, AppleScript, Elixir, Visual Basic .NET, Clojure, Haxe, Objective-C, Rust, Racket, Scheme, AutoHotkey, AutoIt, Kotlin, Dart, Free Pascal, Haskell, Nim, D, Lisp, Kit, V, SCSS, Sass, CUDA, Less, Fortran, and custom command”

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!

Discussion (3)

Editor guide
hanpari profile image
Pavel Morava • Edited

If you omit Jetbrains IDE from your Kotlin learning process, you will miss a lot.

Just saying 😁

I mean you can ditch VS in favor of VS Code for C#, but Kotlin is not the case.

mwrpwr profile image
Joseph Maurer Author • Edited

Jetbrains is known for their code analysis tools that help you code fast, but so far I've honestly been enjoying the simplistic approach that VS Code offers. If you are doing any production Kotlin work, I agree that the IDE would be valuable, but it seems superfluous for simply trying to learn the syntax and language features. VS Code can do a lot of the code completion stuff.

As I get further into Kotlin maybe I'll do a post about the advantages/disadvantages of using the IDE over using VS Code! Thanks for the idea 👍🏻

hanpari profile image
Pavel Morava

You will see. But in my experience, the Jetbrains ecosystem brings Kotlin to another level.