package main
import (
"fmt"
)
type Student struct {
Id string
Name string
Age int
Score float64
}
func NewStudent(id string, name string, age int, score float64) Student {
student := Student{id, name, age, score}
return student
}
func main() {
student := Student{
Id: "st0",
Name: "Name 1",
Age: 20,
Score: 5.6,
}
fmt.Println("Student Info")
fmt.Println("id: ", student.Id)
fmt.Println("name: ", student.Name)
fmt.Println("age: ", student.Age)
fmt.Println("score: ", student.Score)
}
Student Info
id: st0
name: Name 1
age: 20
score: 5.6