Skip to content
RapidFinger — free online typing test

Typing tests

← All programming languages

Go Coding Practice

Practice typing real code syntax, including brackets, punctuation, and indentation. Snippets are for typing practice only and are never executed.

Slices, loops, and conditions

package main

import "fmt"

func main() {
    numbers := []int{3, 8, 12, 5, 10}

    for _, number := range numbers {
        if number%2 == 0 {
            fmt.Println(number)
        }
    }
}

Structs and methods

package main

import "fmt"

type Rectangle struct {
    width  float64
    height float64
}

func (r Rectangle) Area() float64 {
    return r.width * r.height
}

func main() {
    shape := Rectangle{width: 6, height: 4}
    fmt.Printf("Area: %.1f\n", shape.Area())
}

Count words with a map

package main

import "fmt"

func main() {
    words := []string{"go", "code", "go", "learn"}
    counts := make(map[string]int)

    for _, word := range words {
        counts[word]++
    }

    fmt.Println(counts)
}