Golang Basic 1 - Install && Hello World

Golang Basic 1 - Install && Hello World

What is Golang

  • Official website: https://golang.org/
  • Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

How to install

Comments

  • 3 way to write a comments in go program.
  • // this is a single line comment
    
  • /*
    this is a
        multi line
            comment
    */
    

Hello World

usr@host:go/ # cat hello.go
package main    // if you want to run this program
import "fmt"    // import some build in packages, fmt is a packag e for print something on the screen
func main(){    // the main function, the entry of the program
    fmt.Println("Hello world.!")    // call fmt.Println to print something on the screen
}
usr@host:go/ # go build hello.go    # build the program
usr@host:go/ # ./hello  # run it
Hello world.!

发表评论

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据