Go语言 之结构体数组 赋值

package main

import (
    "fmt"
)

type Student struct {
    id    int
    name  string
    score float64
}

func main() {
    s := []Student{
        Student{
            1,
            "yy",
            82,
        },
        Student{
            2,
            "yang",
            67,
        },
        Student{
            3,
            "go",
            91,
        },
    }
    fmt.Println(s)
}
posted on 2021-06-30 17:54  Code2020  阅读(2594)  评论(0编辑  收藏  举报