Expressions

September 8, 2023

There are a number of terms that get thrown around, often semi-interchangeably by the less initiated (such as myself). “Declaration”, “definition”, “statement”, … and today’s topic “expressions”, just to name a few.

But, at least within the context of the Go spec, most such terms have very specific meanings.

Expressions

An expression specifies the computation of a value by applying operators and functions to operands.

So: type foo int and var foo int are not an expressions. There are no computations being specified.

In contrast var foo = 1 + 2 includes an expression (1 + 2 specifically).

For the next while, we’ll be digging into how expressions work in Go.

Quotes from The Go Programming Language Specification Version of August 2, 2023

Share this