ARTIFICIAL INTELLIGENCE
AI Knowledge Base by Sunil Marella
Home Docs

Data Types

Go Data Types are mainly:

  • Basic Types → int, float, bool, string, complex
  • Composite Types → array, slice, map, struct
  • Reference Types → pointer, slice, map, function
  • Interface Types → behavior definition
package main

import "fmt"

func main() {
    var x int = 42 // Integare type
    var y bool = true // Boolean type
    var u8 uint8 = 255 // Unsigned integers
    var i8 int8 = -128 // Signed integers
    var z string = "Sunil" // String type
}