Golang Study Note one: Language specification

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Introduction

Golang Reference Manual For more information, please refer to http://golang.org
Language Specification reference from Https://golang.org/ref/spec

Lexical elements

Comments

Line Comment: // comment content
Paragraph notes:/* comment content */

Symbol

There are 4 types of symbols: identifiers, keywords, operators and separators, literal constants

Semicolon

Golang, semicolons can be omitted

Identifier

Identifiers are variables and types in a program, with one or more letters or numbers, and the first letter must begin with a letter.

identifier = letter { letter | unicode_digit }

Key words

Identifier cannot be a reserved keyword in Golang

 Break        default      func         Interface    Select Case         defer        Go           Map          structChan         Else         Goto          Package      SwitchConst        Fallthrough  if           Range        typeContinue      for          Import       return       var

Operators and separators

The operators, separators, and other special symbols in the Golang as shown below

+    &     +=    &=     &&    ==    !=    (    )-    |     -=    |=     ||    <     <=    [    ]*    ^     *=    ^=     <-    >     >=    {    }/    <<    /=    <<=    ++    =     :=    ,    ;%    >>    %=    >>=    --    !     ...   .    :     &^          &^=

Shaping literal

Shaping literals are shaped constants represented by a sequence of numbers, which can be prefixed by 0 or 0x, representing 8 binary and 16 binary numbers, respectively.

int_lit     "1""9"{ decimal_digit } .octal_lit   "0"{ octal_digit } .hex_lit     "0""x""X"{ hex_digit } .4206000xBadFace170141183460469231731687303715884105727

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.