Go language Programming-syntax

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

Go Comment

Single-line Comment/* */Multiline Comment

Go's built-in keywords

Default Select defer Go goto fallthrough Range

Package (Pack) import (Guide) return (return)

VAR (declaring global variable) type (general type declaration) struct (struct) interface (interface) func (method) map (map type)

Switch case if else for continue break

Const (defining constants)

Chan (channel, for channels between multiple servers for concurrency)


Go Basic type

BOOL: Boolean type

1 bytes, value: True,false, cannot be represented by numbers

Int/uint: Integral type

Depending on the operating platform, it may be 32 or 64bit

Int8/uint8:8 bit integral type

1 bytes, Value: -128~127

BYTE: Byte type

Int16/uint16:16 bit integral type

2 bytes, value: -32768~32767

Int32/uint32:32 bit integral type

4 bytes

int64/uint64:64 bit integral type

8 bytes

Float32/float64: Floating-point type

4/8 bytes Accurate to 7/15 decimal places

complex64/complex128: plural

8/16 bytes sufficient to hold the pointer of the 32-bit or 64-bit integer type: uintptr

Other value types: array, struct, string

Reference type: Slice, map, chan

Interface type: interface

Function Type: func


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.