首页 > 编程语言 > 详细

GO语言程序结构

时间:2015-05-25 16:34:47      阅读:162      评论:0      收藏:0      [点我收藏+]

Go程序主要由以下几部分组成:
包声明
导入包
函数
变量
语句和表达式
注释
以上一篇文章中的Test20150525.go为例:

/* 第一行定义了程序包。必须声明为Go程序运行在什么包。main包是起始点来运行程序。每个包都有一个与之关联的路径和名称。 */
package main

/* import "fmt" 是告诉编译器去包含文件在包fmt的预处理命令。 */
import "fmt"

/* func main()主要功能是为程序执行的开始。*/
func main(){

	//注意println方法。在Go语言中,一个名字如果它用大写字母开头为导出。导出是指一个函数或变量/常访问到相应的包导入。
	fmt.Printf("Hello World!\n God Bless You!"); 
	

}

Genesis 14:13 And there came one that had escaped, and told Abram the Hebrew; for he dwelt in the plain of Mamre the Amorite brother of Eshcol, and brother of Aner ;and these were confederate with Abram.

GO语言程序结构

原文:http://blog.csdn.net/princeterence/article/details/45970629

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!