What Is Scala?
Scala is a programming language that runs on the Java Virtual Machine (JVM). Its name comes from "scalable language": it's designed to grow with you, from short scripts to large, highly concurrent systems.
@main def hello(): Unit =
val languages = List("Scala", "Java", "Kotlin", "Haskell")
val short = languages.filter(_.length <= 5).map(_.toUpperCase)
println(short)
List(SCALA, JAVA)
Its defining traits:
- Object-oriented and functional — everything is an object, and functions are values you can pass around. Scala combines both styles rather than making you choose.
- Statically typed, with inference — the compiler checks types before
the program runs, but you rarely have to write them:
val shortabove is known to be aList[String]. - Expressive — pattern matching, case classes, and powerful collections let you say a lot in little code.
- Runs on the JVM — it uses every Java library, and compiles to the same bytecode as Java. It can also compile to JavaScript (Scala.js) and native code (Scala Native).
Scala was created by Martin Odersky at EPFL in Switzerland and first released in 2004. Scala 3, released in 2021, modernized the syntax and type system. This course uses Scala 3 (the examples were run on Scala 3.9) and notes where older Scala 2 code differs.