studyGo/const/test_const.go
2021-07-11 23:03:35 +08:00

39 lines
562 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* @Description:
* @Version: 2.0
* @Autor: zhuyijun
* @Date: 2021-03-25 21:55:41
* @LastEditors: zhuyijun
* @LastEditTime: 2021-03-25 23:11:53
*/
package main
import (
"fmt"
"github.com/go-redis/redis"
)
func Prt() {
fmt.Print("nihao")
}
const (
// 可以在const()添加一个关键字iota每行的iota都会累加第一行的iota默认值为0
BEIJING = iota
SHANGHAI
SHENZHEN
)
const (
a,b = iota +1,iota+2
c,d
e,f
g,h = iota*2,iota*3
i,k
)
func main() {
fmt.Printf("nihaoya,%v \n", SHANGHAI)
fmt.Printf("nihaoya,%v \n", g)
}