exported.go 372 B

123456789101112131415161718
  1. // In Go capitalized names are exported, and
  2. // non capitalized names aren't
  3. package examples
  4. import (
  5. "fmt"
  6. "math"
  7. )
  8. // Exported: function gets exported so to access this
  9. // outside you must import examples and write
  10. // examples.Exported()
  11. func Exported() float64 {
  12. pi := math.Pi // This is an exported constant from math module
  13. fmt.Printf("%g\n", pi)
  14. return pi
  15. }