What is Golang type uint?

The uint type in Golang is a numeric type that stores unsigned integers.

The following code snippet illustrates how to define a variable of type uint:

var myVar uint = 100

The following table displays the size of uint type on 32-bit systems and 64-bit systems:

Platform Size Range
32-bit system 32-bit 0 to 232 - 1
64-bit system 64-bit 0 to 264 - 1

Example

The following example demonstrates how to define and print a uint variable:

package main
import "fmt"
func main() {
var myVar uint = 222
fmt.Printf("%d",myVar)
}

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved