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.

28 lines
357 B

  1. package main
  2. import "fmt"
  3. func add5Value(count int) {
  4. count += 5
  5. fmt.Println("add5Value :", count)
  6. }
  7. func add5Point(count *int) {
  8. *count += 5
  9. fmt.Println("add5Point :", *count)
  10. }
  11. func main() {
  12. var count int
  13. add5Value(count)
  14. fmt.Println("add5Value post:", count)
  15. add5Point(&count)
  16. fmt.Println("add5Point post:", count)
  17. }