This is a creation in Article, where the information may have evolved or changed.
duang~ Golang Learning Preliminary experience, has always been to go language has a certain sense of joy, today took a little time to understand the next go, in fact, a lot of things to get a small example go run will understand a lot of things.
My development tool uses Gosublime to install this plugin in Sublime Text 2 .
To run the Go program, press ctrl+b and enter the go run file name. Go to view results
Here are some of the basics of Golang's demo
Package Mainimport ("FMT") const (PI = 3.14) func mains (a int) int {fmt. Print (H1 (1212)) return a}func H1 (b int) int {return B}func main () {var b int = 1c: = 2var p *int = &cfmt. Println (mains ()) fmt. Print (b >>) if d: = 2; D >= 2 {fmt. Println (*p)}//for Loop Several ways to use for {c++if c > 4 {break}fmt. Println (c)}m: = 5for m < 8 {m++fmt. Println (M)}for I: = 0; I < 5; i++ {fmt. Print (i)}//switch statement use x: = 3switch x {case 0:fmt. Print (0) case 1:fmt. Println ("X=1") case 2:fmt. PRINTLN (2) default:fmt. Println ("Www.sushou.me")}y: = 1switch {case y >= 0:fmt. Println ("0") Fallthrough//By not jumping out of case y >= 1:fmt. Println ("Www.yiicms.net") default:fmt. Println ("Www.sushou.me")}}
Need to run the effect please use go run one to know!
@author http://www.yiicms.net