001_Go hello world】的更多相关文章

一.go获取程序参数及指针地址示例 package main import ( "fmt" "os" ) func main() { fmt.Println(os.Args); if len(os.Args) > 1{ fmt.Println("Hi", os.Args[1]) }else { fmt.Println("Hello world") os.Exit(3) } fmt.Println(*foo()) } fu…
代码演示: package main import "fmt" func main() { fmt.Println("hello world") } 代码解读: package是关键字,后面跟着包的名字,即main,用于声明这个文件的函数.变量和常量都属于这个包. import是关键字,后面跟着包的名字,用于导入该包. Println是个内置函数,该函数首字母大写.在用import导入fmt包后,就可以直接在main包里使用Println这个函数.相反有很多函数首字…