package returns

import "github.com/mmcloughlin/avo/examples/returns"

Package returns demonstrates how to write function return values in avo.

Index

Functions

func Butterfly

func Butterfly(x0 float64, x1 float64) (y0 float64, y1 float64)

Butterfly performs a 2-dimensional butterfly operation: computes (x0+x1, x0-x1). Demonstrates multiple named return values.

func CriticalLine

func CriticalLine(t float64) complex128

CriticalLine returns the complex value 0.5 + it on Riemann's critical line. Demonstrates returning complex values.

func Interval

func Interval(start uint64, size uint64) (uint64, uint64)

Interval returns the (start, end) of an interval with the given start and size. Demonstrates multiple unnamed return values.

func Septuple

func Septuple(byte) [7]byte

Septuple returns an array of seven of the given byte. Demonstrates returning array values.

Types

type Struct

type Struct struct {
	Word  uint16
	Point [2]float64
	Quad  uint64
}

Struct is used to demonstrate writing struct return values.

func NewStruct

func NewStruct(w uint16, p [2]float64, q uint64) Struct

NewStruct initializes a Struct value. Demonstrates returning struct values.

Source Files

doc.go returns.go stub.go

Version
v0.6.0 (latest)
Published
Jan 7, 2024
Platform
linux/amd64
Last checked
1 month ago

Tools for package owners.