Remembering Things
Remembering Things
Variables let you name values and reuse them later.
example.go
name := "Gopher"
age := 10
happy := trueTwo characters: :=. That's Go's short variable declaration. No type keywords needed. Go looks at the value and picks the type for you. "Gopher" makes name a string. 10 makes age an int. true makes happy a bool.
>_Exercise
Exercise: Order Receipt
Create two variables using :=:
productwith value"Coffee"pricewith value5
Print each on its own line so the output is exactly:
example.go
Coffee
5Stuck? Reveal a hint to help you.
Hints (0/3)
Key Takeaway
Next UpValues that never change.