Exercises & activities from the go workshop provided by Packt: https://courses.packtpub.com/courses/go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
382 B

  1. package main
  2. import "fmt"
  3. type id string
  4. func getIDs() (id, id, id) {
  5. var id1 id
  6. var id2 id = "1234-5678"
  7. var id3 id
  8. id3 = "1234-5678"
  9. return id1, id2, id3
  10. }
  11. func main() {
  12. id1, id2, id3 := getIDs()
  13. fmt.Println("id1 == id2: ", id1 == id2)
  14. fmt.Println("id2 == id3: ", id2 == id3)
  15. fmt.Println("id2 == \"1234-5678\"", string(id2) == "1234-5678")
  16. }