Go variables and data types

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

  basic data types for the Go language   Boolean type: BOOL integral type: int8, Byte, int16, int, uint, uintptr, etc. floating-point types: float32, float64 plural type: complex64, complex128 strings: string character type: Rune fault Type: Error   The int8 represents a byte-long shape (-128 ~ 127), and the corresponding uint8 represents a non-negative byte-length shaping (0 ~ 255), Byte is the same as uint8, the length of an int is associated with the operating system, and the 32-bit system length is 4 bytes. The 64-bit system is 8 bytes; The go language adds a string as the base type, which is different from Java   definition of the Go language variable   Mode 1:   var B1 bool = True   variable definition, preceded by the addition of a var keyword, the entire language like JavaScript (not strict type requirements), followed by the bool type restrictions, in fact, the type of strict language. Turn around from Java and need to adapt.   Mode 2: B2: = True str: = "Hello go"   variable definitions, without the VAR keyword, or the type, where the variable type is qualified by the following value. This is a whole, at the same time B2 can not be in front of the declaration, otherwise will error.   operator   + 、-、 *,/,% with the Java language;   x << y shift left x >> y shift right x ^ y xor x & Y and x | y or ^x Reverse   &NBSP;

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.