scalatutorials

A Tour of Scala

Interactive, bite-sized lessons that run in your browser

Each lesson pairs a short explanation with a live code editor: read on one side, run and tweak real Scala on the other. Nothing to install: the code runs on Scastie, the Scala Center’s online playground.

Your progress is saved in your browser; pages you’ve visited get a checkmark.

Start the tour → (or begin with the overview for a whirlwind feature tour)

Scala basics

  1. Overview · Welcome
  2. Scalculator · Expressions
  3. Operators are methods · Types
  4. Variables · Variables
  5. Final variables · Variables
  6. Printing values · IO
  7. String interpolation · Strings
  8. String formatting · Strings
  9. Useful operations · Operations
  10. Method definition · Methods
  11. Method definition 2 · Methods
  12. Method definition 3 · Methods
  13. Anonymous functions · Functions
  14. Anonymous functions 2 · Functions
  15. Return multiple values · Variables
  16. Declare multiple variables · Variables
  17. Assign multiple variables · Variables
  18. Loops using while · Loops
  19. Loops using for · Loops
  20. Loops without loops · Loops
  21. If · Conditions
  22. Match as a switch · Conditions
  23. Arrays · Collections
  24. Lists · Collections
  25. Sets · Collections
  26. Maps · Collections
  27. Mutable collections · Collections
  28. Collections: accessing elements · Collections
  29. Collections: concatenation · Collections
  30. Mutable collection operations · Collections
  31. Immutable collections with var · Collections
  32. Collections: useful methods · Collections
  33. Classes · Classes
  34. Classes, continued · Classes

What's new in Scala 3

  1. Scala 3: what changed · Scala 3
  2. Optional braces & new control syntax · Scala 3
  3. Top-level definitions & @main · Scala 3
  4. Enums & ADTs · Scala 3
  5. Extension methods · Scala 3
  6. given & using · Scala 3
  7. Union & intersection types · Scala 3
  8. Smaller niceties · Scala 3