初始化

This commit is contained in:
2025-04-08 17:01:19 +08:00
commit 4228f447f7
75 changed files with 574 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
module variables
go 1.23.5

View File

@@ -0,0 +1,16 @@
package main
import "fmt"
func main() {
// 变量声明与初始化
var name string = "Go语言"
age := 28 // 类型推断
// 多变量声明
var width, height = 100, 50
fmt.Println("变量示例:")
fmt.Printf("name: %s, age: %d\n", name, age)
fmt.Printf("width: %d, height: %d\n", width, height)
}