Lesson 2Understanding Go Basics

In this lesson, we will look at the basic building blocks of Go, including tokens, statements, comments, and identifiers. You will use these building blocks to create the code for your Go programs.

UNDERSTANDING STATEMENTS AND TOKENS

A Go program is a series of statements. A Go statement is a series of tokens. In this context, a token refers to any meaningful object in a statement, including the following:

  • Keyword: A reserved word used for special Go functionality
  • Operators and punctuation: Symbols used to do mathematical operations and organize or perform special actions
  • Identifier: Token used to identify things such as storage locations or functions that perform actions
  • Literal: A specific value or number, such as 123 or “Hello, world”

We will look at each of these types of tokens in more detail in this and subsequent lessons. For now, consider the following statement ...

Get Job Ready Go 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.