Quick actions

cmd+k|ctrl+k

Navigation

Languages

Basic types / Constants / Essential Go

Snippet info

Language

Go

Visibility

public

Author

kkowalczyk

Created

2019-03-26T10:02:45Z

Updated

2019-03-26T10:02:45Z

package main

const (
	i  int = 32       // int constant
	s      = "string" // string constant
	i2     = 33       // untyped number constant
)

var (
	// values that are not read-only (like slices or maps or structs) cannot be
	// constants
	// we can declare them as top-level variables
	b = []byte{3, 4} // this could not be a constant
)

func main() {
	// do nothing
}
INFO