Kotlin Tutorial 1 — Introduction

Welcome to the Kotlin Tutorial. This is the first written tutorial series on the Internet that covers all the key basics you will need to know about the Kotlin programming language. The main prerequisite for this tutorial is that you have a basic understanding of programming (already know one programming language — Python, Java, Java Script etc). Despite the tutorial being geared toward Python developers it doesn’t matter if you know a different programming language. Note that the tutorial assumes you will be doing Kotlin development on a PC running Linux Mint 18 (Main edition — 64 bit).

Throughout the series the following tools will be used:

  • Atom 1.12.5 (programmer’s text editor)
  • IntelliJ Community Edition 2016.3 (IDE)
  • Gnome Terminal (terminal emulator)
  • Kotlin 1.0.5–2 (programming language, includes tools like the compiler)
    SDK Man

Kotlin is a pragmatic (industrial), statically typed, multi paradigm (procedural, OO, functional), and general purpose programming language created by Jet Brains in July 2011. The language was created with the aim to make it easier to develop software (of all sizes) that is easier to maintain, and quicker to develop (more productive). Often Kotlin will be used to develop server side (eg micro services), database, and mobile software (Android applications and libraries) as well as test software.

Can also find Kotlin being used to develop desktop applications, scripting for software, DSL’s (Domain Specific Languages), and to a lesser degree front end web applications / websites, even games (eg using libGDX). Jet Brains have plans to expand the use of Kotlin to developing embedded programs (most likely running on ARM micro-controllers without a garbage collector), however that is currently in the investigation phase.

Some of the major companies using Kotlin include the following:

Install Kotlin

Kotlin will be installed via SDK Man, which is a tool that allows software development tools to be easily installed/uninstalled (similar to Synaptic which is included in Linux Mint).

  1. Open the terminal with Ctrl+Alt+t (keyboard shortcut)
  2. Enter the following to install SDK Man: curl -s “https://get.sdkman.io" | bash
  3. Close the terminal and open up a new one
  4. Check that SDK Man is installed by running the following: sdk version
  5. Install Kotlin by running the following: sdk install kotlin 1.0.5–2
  6. When the “Do you want kotlin 1.0.5–2 to be set as default?” prompt appears enter in Y, then press Enter
  7. Check that Kotlin is installed by running the following: which kotlinc

Install Atom

Atom is a simple programmer’s text editor that has support for a wide variety of programming languages via its extensive plug-in system and has built-in Git support.

Illustration 1: Atom with open Kotlin Script file
  1. Open terminal
  2. Change directory to ~/Desktop
  3. Download the deb file by running the following: wget https://atom.io/download/deb
  4. On the desktop double click on the deb file to install Atom
  5. Exit the Package Installer
  6. Close the terminal
  7. Click on the Menu button to show the Applications Menu
  8. In the search box enter in atom
  9. Press Enter to start Atom

Setup Atom

Some plug-ins will need to be installed so that Atom supports Kotlin.

  1. In Atom go to Edit → Preferences
  2. Select the Install section
  3. Install the following packages: file-icons, git-plus, language-kotlin, language-kotlin-ide, linter, linter-kotlin, script
  4. Click the Themes button
  5. Install the following package: dracula-theme
  6. Select the Themes section
  7. Change UI Theme to One Light
  8. Change Syntax Theme to Dracula
  9. Select the Core section
  10. Under Send Telemetry to the Atom Team select Do not send any telemetry data
  11. Select Editor section
  12. Change Tab Length to 4
  13. Change Tab Type to soft
  14. Set Font Family to roboto
  15. Set Font Size to 17
  16. Close the Settings tab (Ctrl+w)
  17. Exit Atom

First Steps

Open a terminal. What do you think will happen when kotlinc (Kotlin Compiler) is run in the terminal?

  • A) Compiler throws a Wobbly
  • B) Basic help information is displayed
  • C) A segmentation fault occurs (memory loss)
  • D) Enters an interactive REPL environment
  • E) Compiler enters a curses session

Correct answer is: Enters an interactive REPL environment.

Illustration 2: Kotlin REPL environment

Enter the Kotlin REPL by running kotlinc. Type the following Kotlin code into the REPL:

Press Enter to run the code. You should see numbers being outputted to the screen. Now type in the following code:

Again press Enter. You should now have something similar to the following:

Illustration 3: Sample Kotlin REPL session

As you can see the Kotlin REPL is very similar to the Python interactive session below:

Illustration 4: Python 3 interactive session

A more fully featured Kotlin REPL can be used in IntelliJ, below is a teaser:

Illustration 5: Kotlin REPL in IntelliJ


That concludes the tutorial introduction which will have you setup for part of the tutorial series. Next tutorial will look at Kotlin’s data types (including its approach to nulls) in Kotlin Tutorial 2 — Basic Data Types.


  1. Kotlin Tutorial 1 — Introduction
  2. Kotlin Tutorial 2 — Basic Data Types
  3. Kotlin Tutorial 3 — Basic Operators
  4. Kotlin Tutorial 4 — Handling Input And Output
  5. Kotlin Tutorial 5 — Basic Collections
  6. Kotlin Tutorial 6 — Control Flow
  7. Kotlin Tutorial 7 — Functions
  8. Kotlin Tutorial 8 — Modularity
  9. Kotlin Tutorial 9 — Using An IDE
  10. Kotlin Tutorial 10 — Classes
  11. Kotlin Tutorial 11 — Inheritance
  12. Kotlin Tutorial 12 — Encapsulation And Polymorphism
  13. Kotlin Tutorial 13 — Generics

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store