@@ -129,7 +129,7 @@ Go对于已声明但未使用的变量会在编译阶段报错,比如下面的
|
||||
var emptyString string = "" // 声明了一个字符串变量,初始化为空字符串
|
||||
func test() {
|
||||
no, yes, maybe := "no", "yes", "maybe" // 简短声明,同时声明多个变量
|
||||
japaneseHello := "Ohaiou" // 同上
|
||||
japaneseHello := "Konichiwa" // 同上
|
||||
frenchHello = "Bonjour" // 常规赋值
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user