]> Cypherpunks repositories - gostls13.git/commitdiff
fmt: add example for Print
authorThanabodee Charoenpiriyakij <wingyminus@gmail.com>
Fri, 7 Sep 2018 11:52:41 +0000 (18:52 +0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 7 Sep 2018 12:31:46 +0000 (12:31 +0000)
Updates #27376

Change-Id: I2fa63b0d1981a419626072d985e6f3326f6013ff
Reviewed-on: https://go-review.googlesource.com/134035
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 6aeee03e43a93df8fdc2eb8c195ed4dcdc7a935a..a09af62757911db600b328721b6b107cf4565a4f 100644 (file)
@@ -49,6 +49,17 @@ func ExampleSprintf() {
        // 15
 }
 
+func ExamplePrint() {
+       n, err := fmt.Print("there", "are", 99, "gophers", "\n")
+       if err != nil {
+               panic(err)
+       }
+       fmt.Print(n)
+       // Output:
+       // thereare99gophers
+       // 18
+}
+
 func ExamplePrintln() {
        n, err := fmt.Println("there", "are", 99, "gophers")
        if err != nil {