Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- )
- type Gender int
- const (
- Male Gender = iota
- Female
- )
- type Person struct {
- name string
- gender Gender
- age uint
- }
- func main() {
- me := Person{gender: Male, age: 30, name: "Michael Chen"}
- fmt.Println(me.name)
- fmt.Println(me.age)
- if me.gender == Male {
- fmt.Println("Male")
- } else {
- fmt.Println("Female")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement