Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- )
- type person struct {
- name, position string
- }
- func newPerson(nm, ps string) *person {
- return &person{nm, ps}
- }
- func main() {
- var name string
- var position string
- fmt.Println("what is your name: ")
- fmt.Scanln(&name)
- fmt.Println("what is your position: ")
- fmt.Scanln(&position)
- p := newPerson(name, position)
- fmt.Println(p.name + " - " + p.position)
- }
Add Comment
Please, Sign In to add comment