第1课 go基础知识

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lhdalhd1996/article/details/52008343
//当前程序的包名
package main

//导入其他的包
import (
    "fmt"
    //  "os"
    //  "strings"
    //  "time"
)

//常量的定义
const (
    PI = 3.14
)

//全局变量的声明与赋值
var name = "gopher"

//一般类型的声明
type nameType int

//结构的声明
type gopher struct{}

//接口的声明
type golang interface{}

//由 main 函数作为程序入口点启动
func main() {
    fmt.Println("Hello world!你好,世界!")
}

//Go 使用大小写来决定该常量,变量,类型,接口,结构或函数 是否可以被外部调用
//根据约定,首字母小写为private,大写为Public

猜你喜欢

转载自blog.csdn.net/lhdalhd1996/article/details/52008343