Type system

Go type conversions

Explicitly converts a value where the conversion rules allow it. Integer conversions can truncate bits; floating-to-integer conversions discard the fractional part toward zero, with implementation-dependent results if out of range. Example output: '44 3'.

Formal Syntax & Structure

go syntaxgo
T(x)

Working Example

Example Snippetgo
package main
import (  "fmt")
func main() {  x := 300  y := 3.9  fmt.Println(uint8(x), int(y))}
Go Reference