Golang- teach you to write a helloword with go

Teach you go to write helloword

During this time, I learned the language of go. Many people may look down upon helloword, but it is a foundation and a must for entry. Not much to say, direct code.

//该处和java类似,需要一个包来存放,一般文件夹和包名一致,也可不一致
package main
//该处需要导入一个打印支持的包
//Java与之类似的是jdk自带的输出
import "fmt"

//与Java类似的是,一个go文件的运行同样需要main方法,不过go写法更加简单,且不需要做static处理,同级别下都能访问
func main() {
	//打印输出,后面‘ ;’可有可无,go语言追求一种简洁和高效性
	fmt.Println("hellword")
}

The above is some of the content I summarized, because it is self-study on the Internet, if there are any errors or supplements, I hope my colleagues will comment more. I will also share some learning experience later.

If you want to tap the basics, and if you are in trouble, I recommend two small tools, the current go development tool, the web version recommendation

https://play.golang.org/

If you want to install the tool, it is best to have an ide. If you want to be free and simple, you can already use vscode, just download one online, and then install a Go, golang and Code Runner plug-in to start your go code. The Chinese plug-in has a Chinese ,Can be Chinese.

Ladies and gentlemen, please support me a lot. Please reprint the link if necessary and respect the originality.

Guess you like

Origin blog.csdn.net/MatChen/article/details/110519765