language: Go (gc-2010-07-14)
date: 202 days 5 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
 
import (
        "fmt"
        "rand"
        "time"
)
 
type Person struct {
        Gender string
        BackLength int
        FrontLength int
}
 
func (p *Person) hasMullet() bool {
        return p.BackLength > p.FrontLength
}
 
func (p *Person) addressMullet() {
        for p.BackLength > p.FrontLength {
                p.BackLength--
                fmt.Println("Decrementing the mullet length!")
        }
        fmt.Println("Mullet cured!")
}
 
func main() {
        fmt.Println("Welcome to the MULLET Program.\n")
        fmt.Println("Creating a new genome to work with...\n")
        person := new(Person)
        rand.Seed(time.LocalTime())
        fmt.Println("Person created.")
        person.Gender = "Male"
        person.BackLength = rand.Intn(25)
        person.FrontLength = rand.Intn(25)
        fmt.Println("----------------------------------------")
        fmt.Println("Gender:", person.Gender)
        fmt.Println("BackLength:", person.BackLength)
        fmt.Println("FrontLength:", person.FrontLength)
        
        if person.hasMullet() {
                fmt.Println("This guy has a mullet!")
                person.addressMullet()
        } else {
                fmt.Println("This guy does not have a mullet.")
        }
}
 
prog.go:31: cannot use time.LocalTime() (type *time.Time) as type int64 in function argument