发布于 2年前
Golang报错: more than one character in rune literal
package main
import "fmt"
func main() {
const (
BEIJING = '北京'
SHANGHAI = '上海'
)
fmt.Println("BEIJING:",BEIJING)
fmt.Println("SHANGHAI:",SHANGHAI)
}
报错:
# command-line-arguments
more than one character in rune literal
more than one character in rune literal
原因 单引号,双引号 的问题, 在go语法中,双引号是常用的来表达字符串,如果你使用了单引号,编译器会提示出错。