The first chapter: helloworld

  Due to busy recently, so the blog updated more slowly, really sorry.

  Since we last article when it comes to the installation go, where I believe we can basically blow your code. Well, the old rules, certainly from 'hello world' began, starting from hello world as to why it? Hey! You do not say, I really studied. Legend has it that long ago there lived a retired programmer, nothing else to do at home, decided to attend the calligraphy of the road. The first day, ready pen and ink, paper and ink, he wrote a brush line of characters: 'hello, world'. ^ _ ^, Kidding! When used for the first hello world origins date back to 1972, the famous Bell Labs researcher Brian Kernighan wrote in "B Language Tutorial and guidance (Tutorial Introduction to the Language B)" (program), which is currently the earliest known computer hello world record book and it will be used with. Then, in 1978, he co-authored by him and Dennis Ritchie C language Bible "The C Programming Language", the extension of the "hello, world" sentence, as the opening of a procedure. In this program, the output of "hello, world" is all lowercase, no exclamation mark, there is a space after the comma. After almost did not come down, although this initial format, but since then has become customary to greet the world with a hello world.

  1, well, no nonsense, and I began to get down to business ... on our Code

  2, first open the editor, create a file .go coding, for example here (hello.go) and then execute the code below:

    package main

    import "fmt"

    func main(){

      fmt.Println("hello world")

    }

  3, execute the command: go run hello.go (.go file name you create)

  4, output: hello world

  5, helloworld finished, we open the next chapter.

  

  

  

Guess you like

Origin www.cnblogs.com/guanyu-go/p/10957027.html