0 Basic Science Golang-2-helloworld

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.
 
  Package Main
Import "FMT"
Func Main () {
Fmt. Print ("Hello, world\n")
}

Run output HelloWorld;

Content analysis:
The FMT:FMT package implements the format I/O functions, similar to the C printf and scanf. The format placeholder is derived from C, but is simpler than c.

So so:

%v the default format for the corresponding value. When the structure is printed, the "Plus" mark (%+v) adds a field name of% #v相应值的Go语法表示%t the corresponding value of the type of the go syntax to represent the percent percent of the literal percentile, not the value of the placeholder

Boolean:

%t the word True or false.

Integer:

The%b binary represents the character%d denoted by the corresponding Unicode code point in%c, the decimal representation of the%o octal representation of the character literal that surrounds the%q single quotation mark, which is safely escaped by the go syntax in the hexadecimal notation, in lowercase a-f%x hexadecimal notation, and in uppercase letters a-f% Uunicode format: u+1234, equivalent to "u+%04x"

Floating point number and its compound composition:

%b is a scientific notation of the power of the exponent two without fractional parts, with StrConv. The formatfloat ' B ' conversion format is consistent. For example, -123456p-78%e scientific notation, such as the -1234.456e+78%e scientific notation, for example -1234.456e+78%f has a decimal point but no exponent, for example 123.456%g chooses%e or%f as appropriate to produce a more compact (no end 0) output% G Select%E or%f as appropriate to produce a more compact (no end 0) output

String and byte slices:

%s string or slice without interpretation byte%q double quotation marks around the string, safely escaped by go syntax%x 16, lowercase letters, two characters per byte%x 16, uppercase letters, two characters per byte

Pointer:

%p hexadecimal representation, prefix 0x


Thanks for the information provided by the Go language Chinese web
 
  

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.