## Key Concepts

Review core concepts you need to learn to master this subject

### Go Values

``````// literal unnamed value
fmt.Println("PI = ", 3.14159)

// constant named value
const pi = 3.14159

// variable named value

In Go, values can be unnamed or named. Unnamed values are literals such as `3.14`, `true`, and `"Codecademy"`. Named values have a name attached to the value and they can either be unchangeable as constants or changeable as variables once defined.

Learn Go: Variables and Types
Lesson 1 of 2
1. 1
Programs, like the ones we write in Go, are excellent at processing and performing operations on data. But in programming, “data” can be so many different things. Data can be numbers, boolean value…
2. 2
In Go, values can be many things. Just to name a few, values can be numbers (like 109), or text wrapped in quotes (like “Hello world”). These values can be written into code as is, and are called _…
3. 3
In addition to literal (aka unnamed) values, there are also named values. Naming a value in Go means creating a word that will represent that value. One example of named values are constants,…
4. 4
Programming languages need to process and organize data. That data is stored as binary numbers (numbers consisting of 0’s and 1’s) in the memory of your computer. In this way, binary numbers are us…
5. 5
Go has 15 different numeric types that fall into the three categories: int, float, and complex. That means there are fifteen different ways to describe a number in Go. This includes 11 different in…
6. 6
Now that we have some background on what types are, we can talk about what variables are and how we make and use them. A variable is a named value (like a constant) with the added feature that it c…
7. 7
There is no shame in having your code fail to run. Programming errors and exceptions happen all the time and learning to read and understand them is an indispensable tool in a programmer’s toolbox….
8. 8
Variables are placeholder names that we use to refer to values that we intend to update over the course of our program. Updating our variable is also called assigning a value to a variable. In or…
9. 9
We’ve talked about numeric types so far, but Go offers a few other built-in types. One particularly useful type is called a string. A string is Go’s type for storing and processing text. In a gen…
10. 10
Even before we assign anything to our variables they hold a value. Go’s designers attempted to make these “sensible defaults” that we can anticipate based on the variable’s types. All numeric varia…
11. 11
There is a way to declare a variable without explicitly stating its type using the short declaration := operator. We might use the := operator if we know what value we want our variable to store wh…
12. 12
There is one more common way to define an int in Go. Computers actually have a default length for the data in their Read-Only Memory (ROM). Some newer comps may have more processing power and can s…
13. 13
Variables are different from constants because we can update them. This update feature becomes incredibly important when we need to use the original value of a variable for a calculation (or any ge…
14. 14
So far we’ve been declaring variables one by one, each on their own separate line. But Go actually allows us to declare multiple variables on a single line, in fact, there’s a few different syntaxe…
15. 15
In this lesson you learned: * How to use literals in a Go program. * How to create constants that give names to values. * The basic types in Go: ints, floats, complexs, and strings. * The different…

## What you'll create

Portfolio projects that showcase your new skills

## How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory