- 01Setting up (what you'll need)
- 02Your first output (println)
- 03Variables (val and var)
- 04Type annotations and basic types
- 05Branching (the if expression)
- 06Repeating (the for expression)
- 07Writing your own function
- 08Repeating (the while loop)
- 09Working with lists (List)
- 10Working with maps (Map)
- 11Classes (object orientation)
- 12case class
- 13Inheritance and traits
- 14Pattern matching (the match expression)
- 15The Option type (null safety)
- 16Higher-order functions, map and filter
- 17object (singletons)
- 18Strings and string interpolation
- 19for comprehensions
- 20[Project] Build a small inventory system
Your first output (println)
This lesson covers the basics of printing in Scala with println.
println("...") displays text on the screen. Scala is highly compatible with Java while being designed to let you write the same thing more concisely.
In the sample code, a single line — println("Hello, Scala!") — sits inside the fixed object Main extends App { ... } frame.
A common early stumble is not realising you can skip Java's public static void main. In Scala, simply extending the App trait makes the code you write inside it the program's starting point.
In professional work, Scala is well known as the language Apache Spark is written in, and is widely used across big-data processing.
๐งช This site can't compile or run Scala directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ nothing is sent anywhere).
