go:basics:variables
Table of Contents
Variables
What is it?
A variable is a named storage location in memory that can hold a value that may change.
What is it used for?
Store data such as inputs, configuration, and computed results.
Example
var age int = 18 name := "Phong" // short declaration const Pi = 3.14 // constant _ = age _ = name _ = Pi
Notes
- `:=` can only be used inside functions.
- Go has zero values: if you don't assign, the variable gets a default value.
Hard words (English)
- variable /ˈveriəbəl/: biến
- storage /ˈstɔːrɪdʒ/: lưu trữ
- memory /ˈmeməri/: bộ nhớ
- short declaration /ʃɔːrt ˌdekləˈreɪʃən/: khai báo rút gọn
- zero value /ˈzɪroʊ ˈvæljuː/: giá trị mặc định
go/basics/variables.txt · Last modified: by phong2018
