美文网首页go语言
go语言基础 hello world

go语言基础 hello world

作者: 4f2308496bdf | 来源:发表于2018-09-17 20:44 被阅读5次

1.常量的定义

//常量定义

const PI  =3.14

2.一般类型声明

type myInt int//数据类型

3.全局变量的声明与赋值

var myName ="golang"

4.结构的声明

type myPerson struct {}

5.接口的声明

type myGolang interface {}

6.hello world !

func main() {

fmt.Println("hello world! 你好世界! ")

}

7.go语言中,使用大小写来决定定义的,常量、变量、结构、类型、接口或函数是否可以被外部调用

根据约定函数名首字母为小写不可以被外部函数所调用即为private(私有)

函数首字母为大小可以被外部调用即为public(公共)

相关文章

网友评论

    本文标题:go语言基础 hello world

    本文链接:https://www.haomeiwen.com/subject/jeednftx.html