← codetypingtest

Swift typing test

Swift reads cleanly, with no semicolons and no parentheses around if conditions, but it has punctuation of its own: ... for closed ranges, ? for optionals, guard let to unwrap them, and underscores in parameter lists like func insert(_ root: Node?, _ value: Int).

Start the Swift typing test

What you'll type in Swift

Example: FizzBuzz in Swift

Swift's FizzBuzz looks like C without the parentheses: if i % 15 == 0 { goes straight to the brace.

for i in 1...15 {
    if i % 15 == 0 {
        print("FizzBuzz")
    } else if i % 3 == 0 {
        print("Fizz")
    } else if i % 5 == 0 {
        print("Buzz")
    } else {
        print(i)
    }
}

Type this program now

Tips for typing Swift faster

All 20 Swift programs

Every program is real, working Swift. 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