Kotlin Academy · Lesson

Setting Up Kotlin: REPL, IntelliJ & Online Playground

Explore the Kotlin playground, REPL, and IntelliJ IDEA to run your first snippets.

Lesson 1 of 413 steps

Setting Up Kotlin: REPL, IntelliJ & Online Playground is a free Kotlin Academy lesson on CoddyKit. This is lesson 1 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the Kotlin Academy learning path, and your progress syncs across the web and the CoddyKit app. The Kotlin Academy course includes 4 lessons in total.

Why Set Up an Environment?

Before writing real Kotlin code you need a way to edit, compile, and run it. Kotlin supports three common entry points: the online Playground, the command-line REPL, and IntelliJ IDEA.

Kotlin Playground

The Kotlin Playground at play.kotlinlang.org runs Kotlin in your browser — no install required. Perfect for tiny snippets and learning.

// Try this in the Playground:
fun main() {
    println("Hello from Playground!")
}

Your First Snippet

The simplest Kotlin program is a main function that prints to the console. Run this snippet and watch the output appear.

fun main() {
    println("Hello, Kotlin!")
}

Installing IntelliJ IDEA

IntelliJ IDEA Community Edition is the recommended local IDE: free, Kotlin-native, and bundled with the Kotlin compiler. Download from jetbrains.com/idea.

Creating a Kotlin Project

In IntelliJ: File → New → Project, pick Kotlin, JVM, and a JDK. IntelliJ scaffolds a src/main/kotlin folder where your .kt files live.

Running Code in IntelliJ

Add a file Main.kt, paste a main function, and click the green ▷ in the gutter. IntelliJ compiles and runs in one step.

fun main() {
    println("Running in IntelliJ")
    println("Kotlin version active")
}

The Kotlin REPL

The REPL (Read-Eval-Print Loop) lets you type Kotlin expressions and see results immediately. Launch it from IntelliJ (Tools → Kotlin → REPL) or via kotlinc on the command line.

// Sample REPL session:
// >>> val x = 10
// >>> x * 5
// res1: kotlin.Int = 50

REPL-Style Expressions

Anything you can type in the REPL also works in a main function. Try arithmetic, string operations, and variable declarations.

fun main() {
    val x = 10
    val y = 5
    println(x + y)        // 15
    println("Hello".length) // 5
}

Command-Line kotlinc

Install the Kotlin compiler via Homebrew (brew install kotlin) or SDKMAN. Then kotlinc Hello.kt -include-runtime -d Hello.jar builds a runnable JAR.

Multiple println Calls

Each println prints one line. Use it freely to trace what your program is doing.

fun main() {
    println("Line 1")
    println("Line 2")
    println("Line 3")
}

Picking Your Tool

For tiny experiments: Playground. For learning and projects: IntelliJ. For quick one-liners: REPL. Most production work happens in IntelliJ.

Quick Check

Which tool requires no installation and runs Kotlin entirely in the browser?

Recap

Three ways to run Kotlin: Playground (zero install), IntelliJ (full IDE), and the REPL (quick experiments). Pick the lightest tool that fits the task.

Free to start

Learn Kotlin with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
51
Lessons
203

Frequently Asked Questions

Is the “Setting Up Kotlin: REPL, IntelliJ & Online Playground” lesson free?

Yes — any 3 lessons of the Kotlin Academy learning path, including “Setting Up Kotlin: REPL, IntelliJ & Online Playground”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The Kotlin Academy course includes 4 lessons in total.

What will I learn in “Setting Up Kotlin: REPL, IntelliJ & Online Playground”?

Explore the Kotlin playground, REPL, and IntelliJ IDEA to run your first snippets. You practise Kotlin Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Kotlin Academy?

No prior experience is required. Kotlin Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 1 of 4.

How long does the “Setting Up Kotlin: REPL, IntelliJ & Online Playground” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Kotlin Academy lesson?

Yes. Every Kotlin Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Setting Up Kotlin: REPL, IntelliJ & Online Playground
  2. val vs var: Immutability From Day One
  3. Kotlin Basic Types: Int, Double, Boolean, Char
  4. Your First Kotlin Program: main, println & Input
← Back to Kotlin Academy