this sums it up pretty well I guess
package beakeyz
import(
"fmt"
)
type Beakeyz struct {
Id int
FavoriteLangs []string
Learning []string
Hates []string
Loves []string
}
// helper function in a readme. Noice
func getAttribute(a []string) string {
var val string
for index, value := range(a) {
if index == len(a) - 1 {
val = append(val, "and " + value)
} else {
val = append(val, value + ", ")
}
}
return val
}
// mega epic
func (self Beakeyz) PrintSelf() {
fmt.Printf("My age is: %s\n", self.Id)
fmt.Printf("My favorite languages are: %s\n", getAttribute(self.FavoriteLangs))
fmt.Printf("I'm currently learning: %s\n", getAttribute(self.Learning))
fmt.Printf("I don't like: %s\n", getAttribute(self.Hates))
fmt.Printf("I love: %s\n", getAttribute(self.Loves))
}
// main function (this comment is for people without eyeballs)
func main() {
var me Beakeyz = &Beakeyz {
Id: 18,
FavoriteLangs: []string{"go", "java", "c"}, // java is just here because of nostalgia, its pretty trash otherwise lol
Learning: []string{"C#", "Rust", "(opperating) systems", "assembly"},
Hates: []string{"not much atm"},
Loves: []string{"skiing", "programming", "music", "crap to do with space"}
}
me.PrintSelf()
}