Keywords
keywords are original ideneifiers which help complier to understand and parse user code
Declare keywords
1
const, func, import, package, type, var
Type denotation keywords
1
chan, interface, map, struct
Control flow keywords
1
break, case, continue, default, else, fallthrough, for, goto, if, range, return, select, switch, defer, go
Idenfiers
Idenfiers ,defined by user, is used to idenfie something. Compose by : Unicode Letter , Unicode Number, Underscore _
;
Keywords can not be used as idenfiers
Idenfier
_
is a special idenfier, called blank idenfierExport (Public) identifier is start with upper case unicode Letter
1
2
3
4
5Player_9
DoSomething
VERSION
Ĝo
ΠUnExport (Private) identifier do not start with upper case unicode letter
1
2
3
4
5
6
7
8_
_status
memStat
book
π
一个类型
변수
エラillegal identifier
1
2
3
4
5
6
7
8
9
10
11
12
13
14// Starting with a Unicode digit.
123
3apples
// Containing Unicode characters not
// satisfying the requirements.
a.b
*ptr
$name
a@b.c
// These are keywords.
type
range