0Pricing
Kotlin Academy · Lesson

Setting Up Kotlin: REPL, IntelliJ & Online Playground

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

Setting Up Kotlin: REPL, IntelliJ & Online Playground is a free Kotlin Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Kotlin Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

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.

Frequently asked questions

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

Yes — the full text of “Setting Up Kotlin: REPL, IntelliJ & Online Playground” is free to read here on the web, and the Kotlin Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Kotlin Academy course, upgrade to CoddyKit PRO.

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; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

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