]> Cypherpunks repositories - gostls13.git/commitdiff
fmt: add Println example
authorRodolfo Rodriguez <rodolfobgibson@gmail.com>
Fri, 31 Aug 2018 00:14:09 +0000 (18:14 -0600)
committerIan Lance Taylor <iant@golang.org>
Fri, 31 Aug 2018 00:43:12 +0000 (00:43 +0000)
Change-Id: Ifd509c0c6a6ea41094b6ae1f4931414325b152fd
Reviewed-on: https://go-review.googlesource.com/132475
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/fmt/example_test.go

index a600ebcafb34b84b5021ffaa9893db045ecd144f..92d5cd519e543534066dc14dc8a06d542f0ffd0d 100644 (file)
@@ -29,6 +29,17 @@ func ExampleSprintf() {
        // 15
 }
 
+func ExamplePrintln() {
+       n, err := fmt.Println("there", "are", 99, "gophers")
+       if err != nil {
+               panic(err)
+       }
+       fmt.Print(n)
+       // Output:
+       // there are 99 gophers
+       // 21
+}
+
 func ExampleFprintln() {
        n, err := fmt.Fprintln(os.Stdout, "there", "are", 99, "gophers")
        if err != nil {