From the course: Transition from Java to Go
Unlock the full course today
Join today to access over 25,200 courses taught by industry experts.
Basic data types
From the course: Transition from Java to Go
Basic data types
- [Instructor] So far, we've been using the string data type for our Hello, World program. Let's explore some of the other Go data types. Data types are used to define what variables can store. Go data types are divided into basic and composite data types. The basic data types include numbers, strings and Boolean types. They are the basic building blocks of our data. The composite data types consist of arrays, structs, pointers, functions, interfaces, slices, maps and channels. These eight composite types use the basic types to build more advanced constructs and structures. In Go, both signed and unsigned integers are available in the 8-bit, 16-bit, 32-bit and 64-bit formats. If we don't specify a size and just declare an int, then its size is either 32 bit or 64 bit according to the platform we are compiling for. This table shows the name, size and range of each type. There are two further integer type aliases.…