Chapter 2
Working with Different Data Types
IN THIS CHAPTER
Declaring variables
Declaring constants
Getting rid of unused variables
Manipulating strings
Converting the data type of one value to another
This chapter explores one of the foundational building blocks of programming: how to declare variables and constants in Go. This chapter also tells you how to manipulate strings in Go and how to convert data from one type to another.
- Basic: Examples include strings, numbers, and Booleans.
- Aggregate: Examples include arrays and structs.
- Reference: Examples include pointers, slices, functions, and channels.
- Interface: An interface is a collection of method signatures.
In this chapter, I focus on the basic data types in Go. (I cover the other data types throughout the rest of this book.)
Declaring Always-Changing Variables
In programming, variables ...
Get Go Programming Language For Dummies now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.