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.

40 lines
434 B

  1. package main
  2. import "fmt"
  3. type point struct {
  4. x int
  5. y int
  6. }
  7. func compare() (bool, bool) {
  8. point1 := struct {
  9. x int
  10. y int
  11. }{
  12. 10,
  13. 10,
  14. }
  15. point2 := struct {
  16. x int
  17. y int
  18. }{}
  19. point2.x = 10
  20. point2.y = 5
  21. point3 := point{10, 10}
  22. return point1 == point2, point1 == point3
  23. }
  24. func main() {
  25. a, b := compare()
  26. fmt.Println("point1 == point2:", a)
  27. fmt.Println("point1 == point3:", b)
  28. }