3aa811f45395af48311c149a4ec5437cfc2c631c.svn-base 263 B

1234567891011121314151617181920212223
  1. package main
  2. import "fmt"
  3. func intSeq() func() int {
  4. i := 0
  5. return func() int {
  6. i++
  7. return i
  8. }
  9. }
  10. func main() {
  11. nextInt := intSeq()
  12. fmt.Println(nextInt())
  13. fmt.Println(nextInt())
  14. fmt.Println(nextInt())
  15. newInts := intSeq()
  16. fmt.Println(newInts())
  17. }