Guest User

Untitled

a guest
Jan 22nd, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. )
  6.  
  7. type person struct {
  8. name, position string
  9. }
  10.  
  11. func newPerson(nm, ps string) *person {
  12. return &person{nm, ps}
  13. }
  14.  
  15. func main() {
  16. var name string
  17. var position string
  18.  
  19. fmt.Println("what is your name: ")
  20. fmt.Scanln(&name)
  21.  
  22. fmt.Println("what is your position: ")
  23. fmt.Scanln(&position)
  24.  
  25. p := newPerson(name, position)
  26.  
  27. fmt.Println(p.name + " - " + p.position)
  28.  
  29. }
Add Comment
Please, Sign In to add comment