Quick actions

cmd+k|ctrl+k

Navigation

Languages

Constants / iota / Essential Go

Snippet info

Language

Go

Visibility

public

Author

kkowalczyk

Created

2019-03-26T10:12:24Z

Updated

2019-03-26T10:12:24Z

package main

import "fmt"

func main() {
	type ByteSize int

	const (
		_           = iota // ignore first value by assigning to blank identifier
		KB ByteSize = 1 << (10 * iota)
		MB
		GB
		TB
		PB
	)
	fmt.Printf("KB: %d\n", KB)
}
INFO