Go Basics

Let's understand the basics of Go with some examples.

Let’s reinforce our knowledge about Go by covering some of its features.

Types

Go provides us with a number of basic data types, similar to other high-level languages. Let’s look at them in more detail.

Basic

The basic data types are numbers, strings, and booleans. In Go, they’re represented with the following types: bool, string, int, int32, uint, uint32, float, and float64, among others. Each type will have its own zero value:

  • false for bool
  • 0 for integers
  • "" for string

If we define a variable without specifying an initial value, the zero value will be used for the initialization.

Pointers

A pointer is a variable that’s used to hold the memory address of another variable. A pointer can be set to nil. There are ...