0%

Go_Fundamental_Learning_Keyword_Identifiers

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 idenfier

  • Export (Public) identifier is start with upper case unicode Letter

    1
    2
    3
    4
    5
    Player_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