mirror of
https://github.com/MADTeacher/go_basics.git
synced 2025-11-23 21:34:47 +02:00
23 lines
382 B
Go
23 lines
382 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
type employee struct {
|
|
name string
|
|
departmentName string
|
|
age uint8
|
|
position string
|
|
}
|
|
|
|
func main() {
|
|
emp2 := employee{
|
|
name: "Tom",
|
|
position: "Intern",
|
|
}
|
|
emp2.age = 22
|
|
emp2.departmentName = "R&D"
|
|
fmt.Println(emp2) // {Tom R&D 22 Intern}
|
|
emp2.position = "Engineer"
|
|
fmt.Println(emp2) // {Tom R&D 22 Engineer}
|
|
}
|