Learn Scala
Blend object-oriented and functional programming on the JVM.
Free to start. Built from a single prompt. No credit card.
Scala is a statically typed language that runs on the Java Virtual Machine and mixes object-oriented and functional styles in one syntax. You get classes and traits next to immutable values, higher-order functions and powerful pattern matching, plus full access to Java libraries. It powers data tools like Apache Spark and many backend services. Scala 3 brought optional indentation-based syntax, enums and cleaner implicits through given and using. Beginners start with val, case classes and collections, then learn to model problems with types. Learnr builds a personalized Scala course from one prompt and teaches it through bite-sized, interactive lessons.
How to learn Scala, step by step
- Install Scala with Coursier and open the REPL. Run the Coursier setup command to get the scala launcher, sbt and a JDK in one go. Type expressions into the REPL to see that almost everything in Scala, including if and match, returns a value.
- Prefer val, expressions and small functions. Write code with val instead of var, and let functions return the last expression instead of using return. Practice defining functions with explicit parameter and return types before relying on type inference everywhere.
- Model data with case classes and enums. Represent a shopping cart or a chess move with case classes and a sealed trait or Scala 3 enum. You get equality, copy and pattern matching for free, which is how idiomatic Scala describes a domain.
- Master collections and for-comprehensions. Chain map, filter, flatMap, groupBy and foldLeft on List, Vector and Map. Then see that a for-comprehension is sugar for flatMap and map, and use it to combine several Option or Either values cleanly.
- Build an sbt project with tests. Create a project with sbt, add a dependency in build.sbt, and write tests with MUnit or ScalaTest. A word-count tool or a small JSON parser makes a good first project that exercises everything so far.
- Explore the ecosystem you want to work in. Pick a direction: Spark for data pipelines, Cats Effect or ZIO for typed functional effects, or Play and http4s for web services. Keep the basics fresh with a short Learnr lesson each day while you go deeper.
What you'll learn
- Write Scala 3 programs with val, def, case classes and enums
- Use pattern matching with match expressions to branch on data
- Transform immutable collections with map, filter, flatMap and fold
- Handle missing values and errors with Option, Either and Try
- Build and test a project with sbt or Scala CLI
What's inside your Scala course
A sample path Learnr builds for Scala. Your real course adapts to your goal and level.
- 1. The JVM, tooling and the Scala REPL
- 2. Values, functions and expressions
- 3. Case classes, traits and enums
- 4. Pattern matching and immutable collections
- 5. Option, Either and for-comprehensions
- 6. Concurrency, testing and a first real project
How long does it take to learn Scala?
A Java or Kotlin developer can write working Scala in 2 to 4 weeks. Starting from Python or JavaScript, expect 2 to 3 months at 5 to 7 hours a week to feel at home. Effect libraries like Cats Effect or ZIO add a few more months.
What you need before you start
Experience with at least one programming language, ideally Java or another typed language. Familiarity with classes, interfaces and generics helps a lot.
Common mistakes to avoid
- Writing Java with Scala syntax, full of var and null. Reach for val, Option and expressions so the compiler can help you.
- Jumping into category theory and effect libraries in week one. Get fluent with collections and pattern matching first.
- Mixing Scala 2 and Scala 3 tutorials without noticing. Implicits became given and using, so check which version a resource targets.
How Learnr builds your course
Type your topic
Tell Learnr you want to learn Scala, or get as specific as you like.
Get a personalized course
Learnr instantly builds a full Scala course tailored to your goal and skill level.
Learn and level up
Move through bite-sized lessons and interactive practice, earning XP and keeping your streak.
Scala questions, answered
Is Scala still worth learning?
Scala remains in use for data engineering with Apache Spark and for backend systems at companies that value strong types. It also teaches functional ideas that transfer to Kotlin, Rust and TypeScript.
Should I learn Scala 2 or Scala 3?
Start with Scala 3 for new learning. Much existing code is still Scala 2, but the core ideas carry over and the two versions can interoperate in one build.
Do I need to know Java first?
No, but knowing the JVM basics helps when you read stack traces or use Java libraries. You can pick those up as you go.
Explore more courses
More programming and tech courses
- Learn Haskell
- Learn Elixir
- Learn Lua
- Learn Dart
- Learn Flutter
- Learn React Native
- Learn Svelte
- Learn Angular
See all programming and tech courses
Ready to learn Scala?
Start your free, personalized Scala course in seconds. .