Basic Variable Types

Go has several built-in types for handling different kinds of data. Here are the most common ones you’ll use:

Common Types

  • int: Signed integers (whole numbers).
  • bool: Boolean values (true or false).
  • string: A sequence of characters.
  • float64: Floating-point numbers (decimals).
  • byte: 8 bits of data (equivalent to uint8).

Usage Examples

var health int = 100

var isAwesome bool = true

var greeting string = "Hello, world!"

var pi float64 = 3.14159

var data byte = 0xFF