daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest May 26th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package main
  2.  
  3. /*Person is a struct type*/
  4. type Person struct {
  5.     Name string
  6.     Age  int
  7. }
  8.  
  9. func main() {
  10.  
  11.     var me Person
  12.     me.Name = "Melvin"
  13.     me.Age = 41
  14.  
  15.     var wife Person
  16.     wife.Name = "Raye"
  17.     wife.Age = 36
  18.  
  19.     var daughter Person
  20.     daughter.Name = "Katherina"
  21.     daughter.Age = 5
  22.  
  23.     var son Person
  24.     son.Name = "Vito"
  25.     son.Age = 2
  26.  
  27.     var family []Person
  28.  
  29.     family = append(family, me, wife, daughter, son)
  30.  
  31.     birthdayToday(&daughter)
  32.  
  33.  
  34. }
  35.  
  36. func birthdayToday(person *Person) {
  37.     person.Age = person.Age + 1
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top