用程序实现 Golang HelloWorld 的编写。
编写 Golang 的第一个程序,在屏幕上输出 “Hello Golang,Hello HaiCoder!”。
在 Golang 中,我们要在屏幕输出,可以使用 print 语句来实现。
package main
import (
"fmt"
)
func main() {
fmt.Println("嗨客网(www.haicoder.net)")
fmt.Println("Hello Golang,Hello HaiCoder!")
}
程序运行后,控制台输出如下:
我们直接在 main 函数里面,使用了 print 语句,输出了我们想要输出的结果。