

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Learn Go
incomplete
2: Declaring a Variable
incomplete
3: Basic Variables
incomplete
4: Short Variable Declaration
incomplete
5: Why Go?
incomplete
6: Comments
incomplete
7: The Compilation Process
incomplete
8: Fast and Compiled
incomplete
9: Type Sizes
incomplete
10: Which Type Should I Use?
incomplete
11: Go Is Statically Typed
incomplete
12: Compiled vs. Interpreted
incomplete
13: Same Line Declarations
incomplete
14: Small Memory Footprint
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Some of Go's most common variable types are:
int: a signed integerbool: a boolean value, either true or falsestring: a sequence of charactersfloat64: a floating-point numberbyte: exactly what it sounds like: 8 bits of dataAnd to use them, their values are set like this:
var health int
health = 100
var isAwesome bool
isAwesome = true
var greeting string
greeting = "Hello, world!"
var pi float64
pi = 3.14159
var data byte
data = 0xFF
Don't worry, we'll talk about a better way to declare variables in the next lesson.
Run (but don't submit yet) the code. Notice that the username is blank!
Set the username variable to the value "eddie_cabot". Then submit the fixed code.