~ubuntu-branches/ubuntu/saucy/golang/saucy

« back to all changes in this revision

Viewing changes to doc/play/fib.go

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2013-07-08 05:52:37 UTC
  • mfrom: (29.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130708055237-at01839e0hp8z3ni
Tags: 2:1.1-1ubuntu1
016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
package main
2
2
 
 
3
import "fmt"
 
4
 
3
5
// fib returns a function that returns
4
6
// successive Fibonacci numbers.
5
7
func fib() func() int {
13
15
func main() {
14
16
        f := fib()
15
17
        // Function calls are evaluated left-to-right.
16
 
        println(f(), f(), f(), f(), f())
 
18
        fmt.Println(f(), f(), f(), f(), f())
17
19
}