Read "Introducing Go" O ' Reilly, 1th, 2 chapters

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed. It's obviously English, all 124 pages.
Very new, version 2016-1.
One, start
Two, type
Three, variable
Four, control structure
Five, array
Six, function
Seven, structure and interface
Eight, bag
Nine, Test
Ten
11, Next


One
Install win version of Go1.5.3.windows-amd64.msi
After
Write a Hello world! it.
Get a new directory to save your code:
E:\renqiwork\src\golang>


Create a new file, text editor
Notepad hw.go


The content is:
Package Main


Import "FMT"


Func Main () {
Fmt. Println ("Hello, S F")
}


Compile:
Go Run hw.go


Output:
Hello, S F


The FMT package is an abbreviation for formatted input and output.
,/* */is a comment
To page 18. is the 6th page of the PDF
Godoc FMT Println


2nd Chapter Type, 9th page
Go is a statically typed program language that cannot be changed after a type is defined.


Integers: uint8, uint16, UInt32, UInt64, Int8, Int16, Int32, Int64


Floating-point type, NaN (not a number), as generated by 0/0.
float32, float64
The 11th page.
Execute command
Go Run floatcal.go


Package Main


Import "FMT"


Func Main () {
Println are case-sensitive.
Fmt. Println ("1.0 + 1.0 =", 1.0 + 1.0)
}


Strings string
Fmt. Println (len ("Hello, World"))//String length: 12
Fmt. Println ("Hello, World" [1]) The ASCII code for the second subscript "E" of the string as an array is 101
Fmt. Println ("Hello," + "World") String connector Application


Booleans Boolean type
&&, | |,!

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.