[Golong]学习笔记(一) 基础知识
发布时间:2020-12-16 18:51:02 所属栏目:大数据 来源:网络整理
导读:Go编程基础 Go的内置关键字(25个) 不多 break default func interface select case defer go map struct chan else goto package switch const fallthrough if range type continute for import return var Go的注释方法(和js一样) 单行注释: // 多行注释
Go编程基础Go的内置关键字(25个) 不多 break default func interface select Go的注释方法(和js一样) 单行注释: // Go程序一般结构 common_structure.go
简单的demo /*
title: common_structure.go
author: orangleliu
date: 2014-08-05
des: the simple demo of erlang
*/
// a package only have a main
package main
// use “import” import other packages
import “fmt”
const Lzz = “Orangleliu”
var name = “erlong”
type age int
type golang struct{
}
func main(){
fmt.Println(“I love Erlog!”)
}
1 导入多个包的方法 import (
“fmt”
“os”
“time”
)
2 使用别名 import (
std “fmt”
)
命名约定使用大小写来区分常量,变量,类型,接口,结构 或函数是共有还是私有 例如: 学习资料地址 本文出自 “orangleliu笔记本” 博客,请务必保留此出处http://www.52php.cn/article/p-zanqcaya-re.html(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
