64-bit Win7 002:hello world! of Go language learning

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

1. Open Liteide and create a new Go source program file.

Select Go Source File in the template;

In C:\Users\Administrator, (other locations can, of course, I am lazy, I use the default location.) Initial learning source code is temporarily stored.

The name of the source file that was created today Hello



2. Since we have chosen a template, the simple code framework has been generated and the complete code is as follows:



We chose the button BR to compile and run and see the following compilation output: Hello world! OK, it's a success.


3. Learn every line of code

Line 1th,//is a single-line comment, there is a/* * * * */comment method.

Line 2nd, this is required, all go files must be in the package XXXX start, for the standalone run of the executable file must be the package main.

Line 4th, in go, the package always appears first, and then import introduces a packet that implements the formatted input and output: FMT.

Line 8th, a function header, the keyword is func.

Line 9th, called the function in the FMT package, prints the string to the screen.


On the whole, when the Go program executes, the first call is the main of the package, and then the Func's main () execution is found in main.


4. Compile and run, BR, is compiled and run, in the compiled output, we see the following:

C:/go/bin/go.exe build [C:/users/administrator]

Success: Process exit code 0.

C:/users/administrator/administrator.exe [C:/users/administrator]

Hello world!

Success: Process exit code 0.

5. Look at some of Liteide's stuff.




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.