Go Data Types

Go provides a rich set of data types including basic types such as numbers, strings, booleans, and more complex types such as arrays, slices, structs, maps, and interfaces.

Basic Data Types

Boolean

The Boolean type represents truth values and is either true or false.

go
var isAvailable bool = true

Integer

Integers can be signed (int, int8, int16, int32, int64) or unsigned (uint, uint8, etc.).

go
var age int = 30

Float

Floating point numbers are represented using float32 and float64.

go
var price float64 = 99.99

String

Strings are a sequence of characters, defined using double quotes.

go
var message string = "Hello, Go!"