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.

Structs and methods

Type the code exactly. Tab inserts four spaces. Code is not executed.

Choose another snippet

Progress: 0%

Current mismatches: 0

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())
}

Type the code exactly, including spaces and indentation.