← codetypingtest

Scala typing test

These programs use Scala 3 and its optional braces: blocks are marked by indentation and keywords like then, do and match, and only one program needs curly brackets at all. What's left to type is @main, <- in for loops, => in case arms and a colon before every type.

Start the Scala typing test

What you'll type in Scala

Example: FizzBuzz in Scala

No braces at all: if ... then ... else builds the result, and indentation does the rest. The indentation is filled in for you, so you only type the words and symbols.

@main def fizzBuzz(): Unit =
  for i <- 1 to 15 do
    val out =
      if i % 15 == 0 then "FizzBuzz"
      else if i % 3 == 0 then "Fizz"
      else if i % 5 == 0 then "Buzz"
      else i.toString
    println(out)

Type this program now

Tips for typing Scala faster

All 20 Scala programs

Every program is real, working Scala. Choose one to start typing it straight away.

Beginner

Intermediate

Advanced

Expert

How the test works

The timer starts on your first key and stops once every character is right. Press Enter for a new line and the indentation is filled in for you. A wrong key shows in red and counts as a mistake; press Backspace to go back and fix it. Your best time for each program is saved in your browser. Read more about how speed and accuracy are calculated, or get tips for typing code faster.

Other languages